Skip Navigation

[Resolved] Custom post status not showing in forms

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 voice and has 0 replies.

>
Author
Posts
#2680183

Ian

I have added a custom post status and it is showing in the backend, but I can not select it using "Set this post status" in any of my forms.

// Registering custom post status
function wpb_custom_post_status(){
register_post_status('rejected', array(
'label' => _x( 'Rejected', 'post', 'vendor', 'recipe', 'restaurant' , 'vendor-photo' , 'vendor-video' ),
'public' => true,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'_builtin' => true, /* internal use only. */
'label_count' => _n_noop( 'Rejected <span class="count">(%s)</span>', 'Rejected <span class="count">(%s)</span>' ),
) );
}
add_action( 'init', 'wpb_custom_post_status' );

// Using jQuery to add it to post status dropdown
add_action('admin_footer-post.php', 'wpb_append_post_status_list');
function wpb_append_post_status_list(){
global $post;
$complete = '';
$label = '';
if($post->post_type == 'post'||'vendor'||'recipe'||'restaurant'||'vendor-photo'||'vendor-video'){
if($post->post_status == 'rejected'){
$complete = ' selected="selected"';
$label = '<span id="post-status-display">Rejected</span>';
}
echo '
<script>
jQuery(document).ready(function($){
$("select#post_status").append("<option value=\"rejected\" '.$complete.'>Rejected</option>");
$(".misc-pub-section label").append("'.$label.'");
});
</script>
';
}
}

#2680184

Ian

OK just figured it out should not have had: '_builtin' => true, /* internal use only. */