duffcub
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Favorite Posts] Favourites appear twice in pageUsing the standard [wp-favorite-posts] shortcode solved this for me
Forum: Plugins
In reply to: [AWSOM News Announcement] Edit interface unavailable in 3.5?I’ve tried this on a fresh installation of 3.5.1, and I can’t get Awsom News to work at all. The plugin activates, but I get no option in the menu to access the configuration, and by manually entering the edit URL, I get a permissions error. Any other ideas welcome!
Forum: Fixing WordPress
In reply to: Custom Taxonomy Post Count IncorrectHi,
After further digging, I think I have a workaround which while not exactly solving the problem, does add a function which corrects the count whenever posts are trashed.
Add this to your functions.php file, and all should be good. I’ve tested it on my site and it appears to be working as expected.
/* * Corrects count in term_taxonomy table for terms which are are not in published posts */ add_action('edited_term_taxonomy','yoursite_edited_term_taxonomy',10,2); function yoursite_edited_term_taxonomy($term,$taxonomy) { global $wpdb; $sql = "UPDATE wp_term_taxonomy tt SET count = (SELECT count(p.ID) FROM wp_term_relationships tr LEFT JOIN wp_posts p ON (p.ID = tr.object_id AND p.post_type = '[post_type]' AND p.post_status = 'publish') WHERE tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.taxonomy = '[taxonomy_name]' "; $wpdb->query($sql); }With thanks to http://wordpress.stackexchange.com/questions/3166/custom-taxonomies-incorrectly-counting-revisions
Forum: Fixing WordPress
In reply to: Custom Taxonomy Post Count IncorrectI’m seeing this exact problem (as described in the original post).
Checking in the wp_term_taxonomy table shows an incorrect count (too high) for certain terms, so I can only assume this count is not being decreased when posts are deleted.
I’ve been trying to track down the relevant code, but as yet no luck – would be grateful for any pointers.