I want to hide or remove a custom post status when it is set to a specific one.
e.g. If I have a post set to status "pendingreviewf" I want to hide the option to change it to the status "shipedf" and "pricenotaxf". I am using the PublishPress plugin to create the custom status.
The code so far:
function adminstage1() {
if ( ! function_exists( 'PublishPress' ) )
return;
if ( ! PublishPress()->custom_status->is_whitelisted_page() )
return;
$hide_post_status = array( 'pendingreviewf' );
if ( ! in_array( get_post_status(), $hide_post_status) ) {
?>
<style>
#post_status option[value="shipedf"] {
display: none;
}
#post_status option[value="shipedf"] {
display: none;
}
</style>
<?php
}
}
add_action( 'admin_head', 'adminstage1' );
I know it's a mess and maybe isn't making any sense, but I include it to show you my coding skills which are below beginners. Any help appreciated.
I want to hide or remove a custom post status when it is set to a specific one.
e.g. If I have a post set to status "pendingreviewf" I want to hide the option to change it to the status "shipedf" and "pricenotaxf". I am using the PublishPress plugin to create the custom status.
The code so far:
function adminstage1() {
if ( ! function_exists( 'PublishPress' ) )
return;
if ( ! PublishPress()->custom_status->is_whitelisted_page() )
return;
$hide_post_status = array( 'pendingreviewf' );
if ( ! in_array( get_post_status(), $hide_post_status) ) {
?>
<style>
#post_status option[value="shipedf"] {
display: none;
}
#post_status option[value="shipedf"] {
display: none;
}
</style>
<?php
}
}
add_action( 'admin_head', 'adminstage1' );
I know it's a mess and maybe isn't making any sense, but I include it to show you my coding skills which are below beginners. Any help appreciated.
I found the solution i was looking for, if anyone in the future has the same question i am posting the answer.
To make a post with lets say "Status1" to show only "Status2" and hides other statuses like "Status3 and Status4" (with css):
function hidepoststatus() {
$post = 'Status1';
global $post;
if ( $post->post_status == 'Status1' ) {
?>
<style>
#post_status option[value="Status3"] {
display: none;
}
#post_status option[value="Status4"] {
display: none;
}
</style>
<?php
}
}
add_action( 'admin_head', 'hidepoststatus' );