Hi,
I have a custom field “count_view”, updated every page load.
However, when a post gets over 100 views it disappears from query?
add_action( 'elementor/query/most_popular_filter', function( $query ) {
$query->set( 'orderby', 'meta_value' );
$query->set( 'meta_key', 'count_view' );
$query->set( 'order', 'DESC' );
} );
function child_theme_head_script() {
if (is_singular('post')) {
$views = get_field('count_view');
$views++;
update_field('count_view',$views);
}
}
add_action( 'wp_head', 'child_theme_head_script' );
try
$query->set( 'orderby', 'meta_value_num' );