4

I want to use an additional, arbitrary post status on one of my custom post types. I'm calling it "limbo", and it's assigned to a post which has been deleted by the user, but one that I still want to keep its data on the database for legacy purposes.

I assign it to a post by hijacking the permanent deletion routine, which is to say I'm not really registering it via the proper WordPress function register_post_status, because a) it's not something I want my users to worry about or deliberately assign to their posts; and b) it's only applicable to a single custom post type, which I cannot specifically target with register_post_status.

I don't feel confident that it's the most reliable solution, though.

Is there a routine check that WordPress would run on the database which would detect this invalid post status and revert it, or am I being overly paranoid?

Either way, is there a better solution which wouldn't rely on full-blown plug-ins like Edit Flow?

2
  • Have you solved this? If not, can you post the code that you have?
    – brasofilo
    Jul 5, 2012 at 1:13
  • I've monitored a test post and everything seems fine so far. I think I must have changed the post_status unwillingly at some point, which got me worried excessively. Still, the question stands unanswered. I don't think the code I have is relevant, though. Think of this: if someone was to change it directly in the db, would it be changed back at some point? Jul 5, 2012 at 7:57

1 Answer 1

1

I'm pretty sure only attachments have post status "enforcement" ("inherit" or "private"), and that's only inside wp_insert_attachment(). Otherwise there's no cron action or routine I'm aware of that'll change stati.

I still think you should opt for registering it though. Without any arguments, everything will still behave the way it does currently; they won't appear in post results, nor as part of the admin UI.

And since WP_Query whitelists post stati, you can now use it's awesome power to grab limbos with post_status=limbo ;)

1
  • Thanks @TheDeadMedic! Makes me feel more confident to continue down that path. I took your suggestion and registered it, and everything is fine on the front end too! Jul 7, 2012 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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