#2059 closed defect (fixed)
bbp_delete_topic is not deleting the child replies
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 2.3 |
| Component: | Code Improvement | Version: | 2.2 |
| Severity: | major | Keywords: | has-patch commit |
| Cc: | wordpress@… |
Description
The query generated by the WP_Query in there looks like:
SELECT wp_posts.ID, wp_posts.post_parent FROM wp_posts WHERE 1=1 AND wp_posts.post_parent = 93 AND wp_posts.post_type = 'reply' AND (wp_posts.post_status <> 'trash' AND wp_posts.post_status <> 'auto-draft' AND wp_posts.post_status <> 'spam' AND wp_posts.post_status <> 'orphan' AND wp_posts.post_status <> 'hidden') ORDER BY wp_posts.post_date DESC
It seems the post_status => any is getting lost somehow.
I'm on WordPress 3.5 trunk
Attachments (2)
Change History (13)
comment:3
johnjamesjacoby — 6 months ago
- Component changed from Topics to Code Improvement
- Keywords needs-patch added
- Milestone changed from Awaiting Review to 2.3
Looks like the safest thing we can do here is include an array of every single post status that's possible for these to have. Being explicit appears to override any of the additional checks that WP_Query::get_posts() does.
I see two usages of post_status 'any' that would need this.
Makes sense. I'll take a pass next week. So,
[publish] => publish [future] => future [draft] => draft [pending] => pending [private] => private [trash] => trash [auto-draft] => auto-draft [inherit] => inherit
Probably all, right?
comment:7
johnjamesjacoby — 6 months ago
Don't forget the bbPress statuses: closed, spam, etc...
get_post_stati returns the bbp stati too:
Array
(
[0] => publish
[1] => future
[2] => draft
[3] => pending
[4] => private
[5] => trash
[6] => auto-draft
[7] => inherit
[8] => closed
[9] => spam
[10] => orphan
[11] => hidden
)
- Resolution set to fixed
- Status changed from assigned to closed
Note: See
TracTickets for help on using
tickets.
Interesting! The post_status=>any won't work for us. get_post excludes all the stati that has 'exclude_from_search':
if ( ! empty( $q['post_status'] ) ) {... more code ...
if ( in_array('any', $q_status) ) { foreach ( get_post_stati( array('exclude_from_search' => true) ) as $status ) $e_status[] = "$wpdb->posts.post_status <> '$status'";... more code ...
} elseif ( !$this->is_singular ) {... more code ...
if ( $this->is_admin ) { // Add protected states that should show in the admin all list. $admin_all_states = get_post_stati( array('protected' => true, 'show_in_admin_all_list' => true) ); foreach ( (array) $admin_all_states as $state ) $where .= " OR $wpdb->posts.post_status = '$state'"; }... more code ...
so, the $this->is_admin is not kicking in when post_status=>any