Custom post status and preview

So actually everything were more simpler, as long as someone (namely me) would have looked how “draft” post status works.

Apparently there are a lot of variables that wordpress codex does not reveal / has documented, such as the following:

register_post_status('purchased', array(
    /* 'label' => _x( 'Purchased', 'post' ),
      'public' => false,
      'exclude_from_search' => true,
      'show_in_admin_all_list' => true,
      'show_in_admin_status_list' => true,
      'label_count'               => _n_noop( 'Purchased <span class="count">(%s)</span>', 'Purchased <span class="count">(%s)</span>' ), */
    'label' => _x('Purchased', 'post'),
    'protected' => true,
    '_builtin' => true, /* internal use only. */
    'label_count' => _n_noop('Purchased <span class="count">(%s)</span>', 'Purchased <span class="count">(%s)</span>'),**
));

I took the code from “draft” (which in fact we all know it works) and duplicated it for my custom post status. Therefore, it is now visible to the owner, but invisible to the others (on the frontend). Once it gets published, it works just fine.

Leave a Comment