I'll cut straight to the chase, and if this feature already exists, sorry! I've been researching without results.
Here it goes:
WordPress hasn't been just a blogging platform for a very long time. People use it to create complex websites and web applications, and things do seem to be headed towards making WordPress an interesting mix of CMS/framework functionality.
When it comes to these kinds of projects, however, I always find myself defining a few (or many!) "core" pages which are basically just routes towards custom templates etc.
Most of the times they don't require content, but they do need a title and a slug.
What bothers me is that once a project is shipped and delivered to a client, that client can easily break his website by changing a page's slug.
So this is what I've been thinking:
What if we were able to define posts of all types through the wp_insert_post function with a "read only" flag?
Details of the idea:
- These posts would be recognised by WordPress as "created via code" + "read only".
- They would be shown in the admin as "created via code, read only".
- The read only part would be true at least for the slug, but it could optionally be extended to other fields as well.
- If a post with the same slug already exists, the one created via code would override it functionality wise, but the original post would obviously still exist in the database and in the wp admin UI. In this scenario, a warning would be shown in the wp admin UI informing the user/developer of this circumstance and asking to take action (action options to be discussed).
AFAIK, there is currently no standard way to accomplish any of this.
I already use "pre_get_posts" extensively to route requests as I see fit, this kind of feature could help a lot in building functionality and routes via code.
What do you guys think? Is it an idea worth exploring? I'd be happy to hack on a plugin if this picks anyone's interest.