Brady Brady - 1 month ago 22
PHP Question

Wordpress create a new post status?

In Wordpress you get the default post statuses: Published, Draft and Pending Review. Is it possible to add some more post types via registering them via the function.php file of the active theme?

Also is it possible to edit the lables of the Publish Meta Box? What I'm submitting really isnt Publishing...

Also like to add I only want these changes made when in my custom post type I've made.

Kind Regards

Scott

Answer

Since WP 3.0, you can use the register_post_status() function ( http://hitchhackerguide.com/2011/02/12/register_post_status/ ) to add new statuses to a post type.

WP itself uses register_post_status() to register the default "published", "draft", etc. statuses on init using the create_initial_post_types() function in wp-includes/post.php ( http://hitchhackerguide.com/2011/02/11/create_initial_post_types/ ).

Look at the code in those links, and you can get an idea of how to use the function.

I hope that helps you get started!

Comments