13

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

6
  • These statuses have profound implications on how the posts are treated and displayed, don't they? I don't imagine you can just add a new one to some list. What new statuses would you want to add?
    – Pekka
    Commented Oct 21, 2010 at 16:59
  • I'm only wanting to add new statuses to my custom post types and with those posts already managing displaying the post through custom queries. With wordpress you can query to display posts depending on what status it is. So adding some statuses such as Sold and Removed shouldnt be much of an issue to the system?
    – Scott
    Commented Oct 21, 2010 at 17:06
  • 1
    @Brady I see. I don't know whether this is easily possible. What about using the tagging / categories system for this instead?
    – Pekka
    Commented Oct 21, 2010 at 17:07
  • @Pekka I was going to use this and will use this if I cannot figure this out. But the reason for trying is because I'm building this for a client and trying to make the interface make as much sense as possible.
    – Scott
    Commented Oct 21, 2010 at 17:09
  • 2
    It might make more sense to add a custom meta field in the right column, immediately under the 'publishing' pane, with a simple drop-down. I don't think the fields you're talking about make sense in the 'post state' dropdown, as 'publishing' refers to the permissions and visibility of that content on the front-end whereas 'sold'/'for sale', etc are more meta information on the content. It's just as easy to filter that information in the templates, and I sincerely doubt that would seem too complicated to the client - and believe me, I'm pretty stringent about that sort of thing as well.
    – Gavin
    Commented Oct 21, 2010 at 20:39

3 Answers 3

18

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!

2

You could write a plugin if you know how. You have to dig into the documentation or similar plugins like this one http://wordpress.org/extend/plugins/edit-flow/ or this one http://wordpress.org/extend/plugins/custom-post-type-ui/

With "Hooks, Actions and Filters" you can change the admin interface, see here http://codex.wordpress.org/Plugin_API

So far I've write just one simple plugin and I don't know the exact steps you have to follow to accomplish this...

Good luck!

1
  • Thanks for your suggestion Keyne but this moment in time I dont have the time to go digging around the API, I'm currently working to a deadline for a client so will have to stick to a custom field solution for now. I was just hoping that some one would know how to do it and present some demo code on how to.
    – Scott
    Commented Oct 22, 2010 at 8:49
1

You can add custom post status' using the register_post_status function. Refer to create_initial_post_types() in http://core.trac.wordpress.org/browser/tags/3.2.1/wp-includes/post.php

Be warned however, that this is not integrated into the Wordpress backend UI.

Not the answer you're looking for? Browse other questions tagged or ask your own question.