Let's say when a user makes a post, rather than having them able to enter just anything into the Post Title input box, can I change that to be a dropdown with specific predetermined items? I've never gone this far into the backend of WP so let me know if this is not within the scope of the CMS.


I'm a relative newbie myself but have been digging deep into post types, and restricting (many) things within Admin. I believe what you are asking for is not something you'll simply configure; it'll require code:

(1) Add a metabox to your post type, with your drop-down title choices as one of the fields in the metabox.

(2) Turn off the edit-ability of the #title element on the post page:

<style type="text/javascript">
jQuery(document).ready(function() {
jQuery( "#title" ).attr( "disabled", true ) });

enqueue that .js, or just inline (echo) it at admin_footer hook - test for your post_type to avoid inadvertent shutting off #title on other pages in admin.

...you may also have to stick a temp value in the #title element, to get the post to save; I'm not sure if that is a required field for saving a post.

(3) Hook into action post_updated, check for your post_type and copy the value of the metabox setting (your desired title) into the post title field, via wp_update_post($post) function.

Obviously there's a ton of detail to be filled in, but that's the way I'd approach it.

(edit): OR - do the whole thing with jQuery; completely re-write the #title element on the post edit page, so the title field becomes a drop-down selector...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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