Lets assume you are creating a Custom Post Type for publishing events. You do not wish to show the publish button to your editors until all the event fields are properly filled and validated.
This can be achieved using below code
1 2 3 4 5 6 7 8 9 10 11 12 13 |
add_action( 'admin_head', 'wpi_hide_publish_button'); function wpi_hide_publish_button(){ global $post; if(get_post_type($post->ID)=="YOUR_CUSTOM_POST_TYPE") { if(ERROR){ //Some logic to validate your custom fields echo "<style> #publishing-action { display: none; } </style>"; } } } |