That’s interesting. They should definitely be getting deleted. How did you delete your topics? Admin-side, or theme-side?
Admin side.
Theme side nothing happens (side is white…)
Something bad happens with my bbPress installation – first the revisions, now that 🙁
ok, got it.
I was sorting the topics by number of replies with this:
<?php
/*
Plugin Name: Set Post Order In Admin
Version: 0.1
Plugin URI: https://wordpress.org/support/topic/336715/
Description: In Posts->Edit, display posts in title order.
Author: MichaelH
Author URI: https://codex.wordpress.org/User:MichaelH/MyPlugins
*/
function set_post_order_in_admin( $wp_query ) {
if ( is_admin()) {
$wp_query->set( 'orderby', 'meta_value_num' );
$wp_query->set( 'meta_key', '_bbp_reply_count' );
$wp_query->set( 'order', 'DESC' );
}}
add_filter('pre_get_posts', 'set_post_order_in_admin' );
?>
this seems to cause the replies not to be deleted, too, curiously.`
Any idea why this happens? And how to delete the orphan replies + postmeta.
That will definitely cause you some grief. pre_get_posts
is called on every posts query that fires, even non-bbPress ones.
In this case, you’re filtering every admin query and looking for a meta value that won’t exist for certain post types (like revisions, pages, posts, attachments, navigation menus, etc…)
You’ll want to target your code much more specifically than you are here, so that you’re only matching the correct query conditions for what you’re trying to accomplish. This might be hard if you’re also trying to filter sidebars and widgets, since you want something broad, but not too broad.