Show custom product status
-
Hi, I have added a custom product status recently and down here is the code. I would like to know how could I show this status in vendors’ products manage page (my-website/store-manager/products) Thanks!
register_post_status( ‘custom-hide-product’, array(
‘label’ => _x( ‘Approved’, ‘post’ ),
‘public’ => false,
‘exclude_from_search’ => true,
‘show_in_admin_all_list’ => true,
‘show_in_admin_status_list’ => true,
‘label_count’ => _n_noop( ‘Approved <span class=”count”>(%s)</span>’, ‘Approved <span class=”count”>(%s)</span>’ ),
) );
add_action( ‘admin_footer’, ‘display_hide_status_option’ );function display_hide_status_option() {
global $post;
$complete = ”;
$label = ”;
if ( $post->post_type === ‘product’ ) {
if ( $post->post_status === ‘custom-hide-product’ ) {
$selected = ‘selected’;
}
echo ‘<script>
jQuery(document).ready(function($){
$(“select#post_status”).append(“<option value=\”custom-hide-product\” ‘ . $complete . ‘>Approved </option>”);
$(“.misc-pub-section label”).append(“‘ . $label . ‘”);
});
</script>
‘;
}
}
- The topic ‘Show custom product status’ is closed to new replies.