Using a private method as an action callback from within a class

It’s not possible to call a private method through an action or filter. When calling add_action or add_filter, WordPress adds the callback to a list of callbacks for that specific action or filter. Then, when do_action or apply_filters is called, WordPress uses call_user_func_array to call the linked functions and methods. As call_user_func_array is not called … Read more

Let private posts stay in status “private” after edit through “editors”

As it doesn’t look as though the OP is coming back, I’m adding their answer as an answer rather than leaving it in the question: For everyone dealing with the same problem: I was able to fix it with a code snippet of another thread: https://wordpress.stackexchange.com/a/172556/87321 Just had to add the post status “pending”, so … Read more

Set posts of a custom post type to be private by default?

The problem with the code in your question is it always intercepts. You completely lose the ability to not publish, no drafts possible. Why this leads to untrashable post is something I didn’t inspect further. Anyway this isn’t what one wants. I’m glad the javascript solution is working for you, but personally I have two … Read more

How can I make it so the Add New Post page has Visibility set to Private by default?

since you’re developing a plug-in, I assume you don’t want to touch any files outside of wp-content/plugins or ../themes for that matter. However, if that’s not the case, follow along: Go to wp-admin/includes/meta-boxes.php and find: $visibility = ‘public’; $visibility_trans = __(‘Public’); Now change it to the obvious: $visibility = ‘private’; $visibility_trans = __(‘Private’); Again, this … Read more