ap_update_views_count( integer|false $post_id, integer|false $views = false )
Description #
Update views count of qameta.
Parameters #
- $post_idinteger | false (Required) Question ID.
- $viewsinteger | false (Optional) Passing view will replace existing value else increment existing. Default value: false
Source #
File: includes/qameta.php
function ap_update_views_count( $post_id, $views = false ) {
if ( false === $views ) {
$qameta = ap_get_qameta( $post_id );
$views = (int) $qameta->views + 1;
}
ap_insert_qameta( $post_id, array( 'views' => $views ) );
return $views;
}
Expand full source code Collapse full source code View on GitHub: includes/qameta.php:378
Add your comment