Get the number of pageviews for a given post ID.

Default to the current post.


Name Type Description
$post_id int Optional. The post ID to fetch stats for. Defaults to the $post global's value.
$num_days int Optional. How many days to go back to include in the stats. Default is 1. Maximum 90 days.
$end_data string Optional. The last day of the desired time frame. Format is 'Y-m-d' (e.g. 2007-05-01) and default is today's UTC date.

Return Value

int|false: Number of pageviews or false on error.

Ready to get started?

Drop us a note.

No matter where you are in the planning process, we’re happy to help, and we’re actual humans here on the other side of the form. 👋 We’re here to discuss your challenges and plans, evaluate your existing resources or a potential partner, or even make some initial recommendations. And, of course, we’re here to help any time you’re in the market for some robust WordPress awesomeness.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.