phpface

Untitled

Aug 31st, 2021 (edited)
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.40 KB | None | 0 0
  1. function videotube_get_total_post_views() {
  2.     global $wpdb;
  3.    
  4.     $query = $wpdb->get_var( $wpdb->prepare(
  5.         "
  6.         SELECT sum(meta_value)
  7.         FROM $wpdb->postmeta LEFT JOIN $wpdb->posts ON ( $wpdb->postmeta.post_id = $wpdb->posts.ID )
  8.         WHERE meta_key = %s
  9.         AND $wpdb->posts.post_status = %s
  10.         AND $wpdb->posts.post_type = %s
  11.         ",
  12.         'count_viewed',
  13.         'publish',
  14.         'video'
  15.     ) );
  16.  
  17.     return $query;
  18. }
Add Comment
Please, Sign In to add comment