Proposed modification: add instance variables filter to get_popular_posts()
-
Hello, I have a modification proposal to add an instance variable filter to get_popular_posts().
I needed to modify the post_type query to include some custom post types so popular posts would show. Not finding an existing filter, I thought this to be the best place to add one:
function get_popular_posts($instance, $return = false) {
// update instance's settings
$instance = $this->array_merge_recursive_distinct($this->defaults, $instance);
$instance = apply_filters('wpp_instance', $instance);
That way, in my own plugin, I can do this:
add_filter('wpp_instance', function($instance) {
$instance['post_type'] .= ',gallery';
return $instance;
});
- The topic ‘Proposed modification: add instance variables filter to get_popular_posts()’ is closed to new replies.