Conversation
supportSince 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'));
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'));