WPIntell

Source evidence

Cannot delete or delete posts

Private Suite · support · 2013-06-29T15:36:00+00:00

complaintsentiment
mediumseverity
0.92relevance
2replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

3 / 23 rows with source links

13.0% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

20 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
Zbung unresolved
Since I’ve installed Private Suite plugin, I cannot delete posts which are in categories set as private. I cannot make them public as well (for this second point maybe it’s the correct behaviour of the plugin). Thanks for your reply. http://wordpress.org/extend/plugins/private-suite/ I too am having difficulty trashing private posts. It’s quite maddening. Found the problem. Private suite does its thing by hooking onto the save_post action, blindly sets the status to private for posts within the specified categories. wp_trash_post calls wp_insert_post which trips the save_post action, resulting in the posts status being changed back to private. Here’s the patch (line numbers may be off a bit, since I have local fixes for other foibles too): --- private-suite.php~ 2012-06-26 11:33:04.000000000 -0500 +++ private-suite.php 2013-07-17 08:43:53.000000000 -0500 @@ -83,7 +83,9 @@ if ($parent_id = wp_is_post_revision($postid)) $postid = $parent_id; $options = get_option('private_suite'); - if (get_post_type($postid) != 'page' && in_category($options['categories'], $postid)) { + if( get_post_status($postid) != 'trash' && + get_post_type($postid) != 'page' && + in_category($options['categories'], $postid)) { // unhook this function so it doesn't loop infinitely, update the post, then re-hook remove_action('save_post', 'set_private_categories', 10, 1); wp_update_post(array('ID' => $postid, 'post_status' => 'private'));

Comments

2 shown
belg4mit 2013-07-17T13:18:00+00:00

I too am having difficulty trashing private posts. It’s quite maddening.

belg4mit 2013-07-17T13:45:00+00:00

Found the problem. Private suite does its thing by hooking onto the save_post action, blindly sets the status to private for posts within the specified categories. wp_trash_post calls wp_insert_post which trips the save_post action, resulting in the posts status being changed back to private. Here’s the patch (line numbers may be off a bit, since I have local fixes for other foibles too): --- private-suite.php~ 2012-06-26 11:33:04.000000000 -0500 +++ private-suite.php 2013-07-17 08:43:53.000000000 -0500 @@ -83,7 +83,9 @@ if ($parent_id = wp_is_post_revision($postid)) $postid = $parent_id; $options = get_option('private_suite'); - if (get_post_type($postid) != 'page' && in_category($options['categories'], $postid)) { + if( get_post_status($postid) != 'trash' && + get_post_type($postid) != 'page' && + in_category($options['categories'], $postid)) { // unhook this function so it doesn't loop infinitely, update the post, then re-hook remove_action('save_post', 'set_private_categories', 10, 1); wp_update_post(array('ID' => $postid, 'post_status' => 'private'));