0

When editing a post, the title field displays the placeholder "Enter title here" (it's actually a label element that's made to look like a placeholder attribute, but whatever). I have a custom post type where I'm using the title for something specific and I want to make it clearer what it is. Is there any way to modify this field or the way it's outputted?

I couldn't find any filter for this. I could hook after it with edit_form_after_title, but I want to modify the field itself. I could remove the title field and use my own, but I want it to have the appearance of WordPress's title field.

3

You can add following code to your functions.php in the Theme-folder.
Change the Custom Post Type(movie) name and the title to your wishes.

function wpse213979_new_title_text( $title, $post ){ 
   if  ( 'movie' == $post->post_type ) { // Movie is the cpt name
      $title = 'Enter movie name'; // The text you want to be shown
   }

   return $title;
}
add_filter( 'enter_title_here', 'wpse213979_new_title_text', 10, 2 );

The code reference

Hope this is what you where looking for.

  • Wow, thanks. That filter isn't listed on the reference page. Is there any page that has it and filters like it (besides the complete list of hooks)? – Hutch Moore Jan 7 '16 at 18:50
  • 1
    Ehm, to be honest except this I can't find it neither. So, computer says no . – Charles Jan 7 '16 at 20:30

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.