[Plugin: WordPress Popular Posts] Exclude and include categories
-
I wanted not to exclude but to include categories in the wordpress popular posts configuration.
So I cloned the exclude category feature, and I realized that the select that is used has an unnecessary subselect.
The original select is:$exclude = " AND $wpdb->posts.ID NOT IN ( SELECT object_id FROM $wpdb->term_relationships AS r JOIN $wpdb->term_taxonomy AS x ON x.term_taxonomy_id = r.term_taxonomy_id JOIN $wpdb->terms AS t ON t.term_id = x.term_id WHERE x.taxonomy = 'category' AND object_id IN ( SELECT object_id FROM $wpdb->term_relationships AS r JOIN $wpdb->term_taxonomy AS x ON x.term_taxonomy_id = r.term_taxonomy_id JOIN $wpdb->terms AS t ON t.term_id = x.term_id WHERE x.taxonomy = 'category' AND t.term_id IN (".$instance['exclude-cats']['cats']."))) ";It can be substituted with the way more simple (and quicker):
$exclude = " AND $wpdb->posts.ID NOT IN ( SELECT object_id FROM $wpdb->term_relationships AS r JOIN $wpdb->term_taxonomy AS x ON x.term_taxonomy_id = r.term_taxonomy_id JOIN $wpdb->terms AS t ON t.term_id = x.term_id WHERE x.taxonomy = 'category' AND t.term_id IN (".$instance['exclude-cats']['cats'].")) ";I tested it and it works smoothly.
How can I send the modified source to the plugin’s owner?
http://wordpress.org/extend/plugins/wordpress-popular-posts/
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
The topic ‘[Plugin: WordPress Popular Posts] Exclude and include categories’ is closed to new replies.