Using arbitrary post status without registering it

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?

1 Answer
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 😉

Leave a Comment