The “pop_viewed_join” filter is used modify the JOIN MySQL statement on for the most viewed results.

A plugin (or theme) can modify statement with the code:

<?php add_filter( 'pop_viewed_join', 'filter_function_name' ); ?>

The hook is located in the popular-widget/_inc/functions.php file.


// Apply filter
function modify_pop_viewed_join( $join, $instance ) {
	global $wpdb;
	return $join . " JOIN $wpdb->post p ON p.ID = tr.object_id";
add_filter('pop_viewed_join', 'modify_pop_viewed_join');

Note:  $join is a MySQL join statement string, $instance is a widget object.

Leave a Reply

Your email address will not be published. Required fields are marked *