[wp-hackers] Incorrect documentation for register_post_status

Nikola Nikolov nikolov.tmw at gmail.com
Mon Jul 7 11:43:16 UTC 2014


That's the thing - I don't want posts with that status to be public.

However, in theory(according to the documentation), setting
"show_in_admin_all_list" to true should make posts with that post status
visible in the "All" section of the posts list.

What I'm not sure about is what the "protected" property of a post status
is used for.


On Mon, Jul 7, 2014 at 10:26 AM, Pascal Birchler <pascal.birchler at gmail.com>
wrote:

> How does your code look like? It seems like setting the `public` argument
> to true should be enough. See the lines above:
>
> https://github.com/WordPress/WordPress/blob/3.9-branch/wp-includes/query.php#L2810
>
>
> 2014-07-04 15:38 GMT+02:00 Nikola Nikolov <nikolov.tmw at gmail.com>:
>
> > I had to add a new custom post status and so I looked-up the
> documentation
> > for the register_post_status()
> > <http://codex.wordpress.org/Function_Reference/register_post_status>
> > function and adjusted the sample code from there.
> >
> > I found a way to add the post status to the status drop-down on the
> > add/edit posts screens and changed the status of one of the posts.
> >
> > It all worked as expected - the post status was now updated for that
> post.
> >
> > Then I went back to the posts screen for my custom post type and I saw
> the
> > post status link on top, showing me that there's 1 post with that post
> > status. That's also correct.
> >
> > However the post disappeared from the list of posts, even though I've set
> > "show_in_admin_all_list" to true in the arguments for the post status.
> >
> > So I looked around and found out that in /wp-includes/query.php on line
> > #2819
> > <
> >
> https://github.com/WordPress/WordPress/blob/3.9-branch/wp-includes/query.php#L2819
> > >
> > ,
> > WordPress is getting registered post statuses with
> show_in_admin_all_list =
> > true AND protected = true
> >
> > The *protected* argument is not documented anywhere, but after I set that
> > to true in my arguments list, the post appeared again.
> >
> > I would go in and document that myself, but I really have no clue what
> > *protected* is used for and I don't want to advise people to add it in
> just
> > because it works.
> >
> > If anyone has more insight, I'd be happy to hear it.
> >
> > Nikola
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list