I have a custom post status for my WooCommerce products, and it works as it should. Only problem is when visiting a product in the backend I cannot see the status (although it is toggled on). Is there any way to make it show?
Edit: It does show in the drop-down menu, when previewing it (as seen in the image) the text does not show. So I can't see that it is chosen, as if it was published or a draft - that is the problem Im trying to solve!
Picture of the problem:
Here is my code:
register_post_status( 'custom-hide-product', array(
'label' => _x( 'Slukket Produkt', 'post' ),
'label_count' => _n_noop( 'Slukket Produkt <span class="count">(%s)</span>', 'Slukket Produkt (%s)', 'post' ),
'public' => false,
'exclude_from_search' => true,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
// 'label_count' => _n_noop( 'Slukket Produkt <span class="count">(%s)</span>', 'Slukket Produkt <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 . '>Slukket Produkt</option>");
$(".misc-pub-section label").append("' . $label . '");
});
</script>
';
}
}
I hope someone can guide me in the right direction - the Dev WP page didnt help me!
