[wp-hackers] Custom Post Status

Mike Schinkel mikeschinkel at newclarity.net
Thu Aug 26 23:54:19 UTC 2010


On Aug 26, 2010, at 6:49 PM, Ryan Bilesky wrote:
> Ok now is there a way by chance to remove a built in post status, or at
> least prevent it from being selected when writing a post.


Unfortunately the status list in the Publish metabox is all hard-coded!  See lines 85-104 in /wp-admin/includes/meta-box.php so unless you want to hack core I think the only want to do it is with jQuery/Javascript.  If you want to inject the <script> code to do it just below where is the status are display the hook "post_submitbox_misc_actions" should work.

Here's some code that will remove the 'Pending Review' status from the metabox. You should be able to take it from there:

add_action('post_submitbox_misc_actions','my_post_submitbox_misc_actions');
function my_post_submitbox_misc_actions() {
	$js =<<<JS
<script type="text/javascript">
jQuery(document).ready(function($) {
	$("#misc-publishing-actions select#post_status option[value='pending']").remove();
});
</script>
JS;
	echo $js;
}

Hope this helps.

-Mike



More information about the wp-hackers mailing list