Problem deleting posts from trash

Technically, defining define(‘EMPTY_TRASH_DAYS’, 0 ); in wp-config.php file should delete whatever is in Trash after zero days. I just tried it, but didn’t work immediately. I may have to wait for a day to see the result.

WP Posts Not Adding Up

Definitely time for an upgrade. 🙂 Try logging into your admin and following the link below. Just make sure to change ‘yoururl.com’ to whatever your website name is. If you have posts in the trash, that should take you to your trash to see them. http://yoururl.com/wp-admin/edit.php?post_status=trash&post_type=post

get_option(‘sticky_posts’) returns stickies that are in trash

Why is that even happening aside, from quick look at core it does the following to achieve that in WP_Posts_List_Table class: $sticky_posts = implode( ‘, ‘, array_map( ‘absint’, (array) $sticky_posts ) ); $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( “SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN (‘trash’, ‘auto-draft’) AND ID IN … Read more

Conditionally process comments while ignoring replies

Simply check if the comment has a parent before decrementing points. Reading the Codex entry for the get_comment() function, you’ll note that in the manner you use the function you will be returned an object containing keys that correspond to the column names of the wp_comments table. Viewing the wp_comments scehma, note that there is … Read more

Trash a post, send associated comments into the trash bin (change status)

There’s an action called trashed_post_comments that runs right after the comments are set to post-trashed status. You could hook into that: add_action( ‘trashed_post_comments’, ‘wpse134528_really_trash_comments’ ); function wpse134528_really_trash_comments( $post_id ) { $args = array( ‘post_id’ => $post_id, ‘status’ => ‘post-trashed’, ); $comments = get_comments( $args ); foreach( $comments as $comment ) { wp_trash_comment( $comment->comment_id ); } … Read more