ap_get_views( integer $ref_id, string $type = 'question' )
Description #
Get views count from views table.
Parameters #
- $ref_idinteger (Required) Reference id.
- $typestring (Optional) View type. Default value: 'question'
Source #
File: includes/views.php
function ap_get_views( $ref_id, $type = 'question' ) { global $wpdb; $query = $wpdb->prepare( "SELECT count(*) FROM {$wpdb->ap_views} WHERE view_ref_id = %d AND view_type = %s", $ref_id, $type ); $count = (int) $wpdb->get_var( $query ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.NotPrepared return $count; }
Expand full source code Collapse full source code View on GitHub: includes/views.php:154
Add your comment