Changeset 4524 for trunk/includes/topics/functions.php
- Timestamp:
- 11/26/2012 05:43:43 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/topics/functions.php
r4522 r4524 2935 2935 2936 2936 // Topic is being permanently deleted, so its replies gotta go too 2937 if ( $replies = new WP_Query( array( 2937 // Note that we get all post statuses here 2938 $replies = new WP_Query( array( 2938 2939 'suppress_filters' => true, 2939 2940 'post_type' => bbp_get_reply_post_type(), 2940 'post_status' => 'any',2941 'post_status' => array_keys( get_post_stati() ), 2941 2942 'post_parent' => $topic_id, 2942 2943 'posts_per_page' => -1, 2943 2944 'nopaging' => true, 2944 2945 'fields' => 'id=>parent' 2945 ) ) ) { 2946 ) ); 2947 2948 // Loop through and delete child replies 2949 if ( ! empty( $replies->posts ) ) { 2946 2950 foreach ( $replies->posts as $reply ) { 2947 2951 wp_delete_post( $reply->ID, true ); … … 2951 2955 wp_reset_postdata(); 2952 2956 } 2957 2958 // Cleanup 2959 unset( $replies ); 2953 2960 } 2954 2961 … … 2977 2984 2978 2985 // Topic is being trashed, so its replies are trashed too 2979 if ($replies = new WP_Query( array(2986 $replies = new WP_Query( array( 2980 2987 'suppress_filters' => true, 2981 2988 'post_type' => bbp_get_reply_post_type(), … … 2985 2992 'nopaging' => true, 2986 2993 'fields' => 'id=>parent' 2987 ) ) ) { 2994 ) ); 2995 2996 if ( !empty( $replies->posts ) ) { 2988 2997 2989 2998 // Prevent debug notices … … 3004 3013 wp_reset_postdata(); 3005 3014 } 3015 3016 // Cleanup 3017 unset( $replies ); 3006 3018 } 3007 3019
Note: See TracChangeset
for help on using the changeset viewer.