This function allows you to get the number of views of a given post or array of post. Optionally for the specified time period.

Usage

pvc_get_post_views( $post_id = 0, $period = 'total' );

Parameters

$post_id int / array required

Post ID or array of post ID’s

$period string optional pro

The time period from which we want to retrieve the number of visits. Available period options are:

  • total
  • today
  • yesterday
  • last_3_days
  • last_7_days
  • last_30_days
  • this_week
  • last_week
  • this_month
  • last_month
  • this_year
  • last_year

Return

The function returns the sum of the post views as a number.