Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is it possible to edit existing registered post statuses?

I am using the Edit Flow plugin to create custom statuses, however, the plugin does not offer the option to set whether the statuses are 'public' or not. I went in to the code and was able to insert that in, but obviously that will get overwritten with any updates. Essentially, I am looking for a complimentary function to add_post_type_support() for post statuses.

So something like

add_action('init', 'my_custom_init');
function my_custom_init() {

      add_post_status_support( 'custom_status', array('public'=>true) );

}
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

You can alter a post status after init by changing the global variable $wp_post_statusses:

function alt_post_status() {
    global $wp_post_statuses;

    $wp_post_statuses['custom_status']->public = true;
}

add_action( 'init', 'alt_post_status' );

register_post_status() (line 922) does the same thing:

...

global $wp_post_statuses;

if (!is_array($wp_post_statuses))
    $wp_post_statuses = array();

// Args prefixed with an underscore are reserved for internal use.
$defaults = array(
    'label' => false,
    'label_count' => false,
    'exclude_from_search' => null,
    '_builtin' => false,
    'public' => null,
    'internal' => null,
    'protected' => null,
    'private' => null,
    'publicly_queryable' => null,
    'show_in_admin_status_list' => null,
    'show_in_admin_all_list' => null,
);
$args = wp_parse_args($args, $defaults);
$args = (object) $args;

...

$wp_post_statuses[$post_status] = $args;

...
share|improve this answer
    
Works perfectly, the first part anyway, didn't test the second since the first worked ha –  Kyle Dec 21 '12 at 14:58
add comment

Your Answer

 
discard

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.