WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a custom post status which should be public visible but not displayed in the "all" list of the edit screen.

This is how I register the post status:

register_post_status('my_custom_post_status', array(
    'label' => __('The Label', 'domain'),
    'public' => true,
    'exclude_from_search' => true,
    'show_in_admin_all_list' => false,
    'label_count' => //blablabla

The show_in_admin_all_list = false should hide the status in the all-list but it doesn't. Only if I set the public to false it is not visible. But I need public = true!

Any ideas

Codex: http://codex.wordpress.org/Function_Reference/register_post_status

share|improve this question
register_post_status is not! meant to be used by themes or plugins. I wrote a pretty intense plugin to work around that fact, but anyway: It's not that simple and you will simply have to drop the idea of custom post status. Search through my answers to read more about it. – kaiser Oct 9 '12 at 18:58
What exactly do you mean!? I've already incorperate custom stati in my plugin and have no problems. You have to many answers to look through. Any specific one? – revaxarts Oct 9 '12 at 19:07
You will have to search on your own, but to sum it up: The post status is hard coded in lots of cases in core and even when this works in some cases, it will simply crash in others. Believe me: I digged a lot in core and you'll be surprised, where the post status is used. And you're missing lots of cases when just throwing and additional status in. Hint: The post status API is not finalized since WP 3.0 - you can see this in the incomplete phpDocBlocks and read on wp-hackers about it. – kaiser Oct 9 '12 at 19:28
Yes I found them missing in the quick edit section for instance and on some other places. I did some workaround in two or three cases so should not a big deal to "fix" this on later version – revaxarts Oct 9 '12 at 19:43
Do whatever you want, I already stated that you'll run into problems - incl. the fact that the API is already started and will be finished with some version. Prepare to hit the wall ;) ... and rebuild everything (incl. fixing everything in your DB) with a future version. – kaiser Oct 9 '12 at 20:05
up vote 5 down vote accepted

This solves my problem:

register_post_status('my_custom_post_status', array(
    'label' => __('The Label', 'domain'),
    'public' => !is_admin(),
    'exclude_from_search' => true,
    'show_in_admin_all_list' => false,
    'label_count' => //blablabla

!is_admin() makes the status only public on the frontpage.

If you find a better solution please post it here!

share|improve this answer

My approach, inspired by @revaxarts, is this:

if (is_admin() && $_GET['post_type'] == 'post') {
  $makepublic = true;
} else {
  $makepublic = false;

register_post_status( 'suspended', array(
      'label'                     => _x( 'suspended', 'Status General Name', 'myadvert' ),
      'public'                    => $makepublic,
      'exclude_from_search'       => true,
      'show_in_admin_all_list'    => true,
      'show_in_admin_status_list' => true,
      'label_count'               => _n_noop( 'Suspended <span class="count">(%s)</span>', 'Suspended <span class="count">(%s)</span>' )
 ) );

Because I do not want it to see those post on the frontend while I am logged in as admin.

share|improve this answer
is_admin actually returns true or false based on if you are looking at an admin screen or not. It doesn't have anything to do with your user role. – Matt Keys Oct 4 '14 at 6:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.