WordPress 3.1 adds a new filter that allows you to change the ‘Enter Title Here’ text that appears in the title input text field. Here’s how it looks now:

With a little bit of magic, we can get our own text there. Previously this required using javascript to change this text, but 3.1 creates a new ‘enter_title_here’ filter that gives us better control.

To change the default text, simply create a new function and hook it to the ‘enter_title_here’ filter, such as below:


function jk_change_default_title( $title ){

     $title = 'My New Title';

     return $title;
}

add_filter( 'enter_title_here', 'jk_change_default_title' );

For better control, we can use this to only change the title of specific post types. This is great for custom post types. In this example, we’ll use the custom post type of ‘invoice’.


function jk_change_default_title( $title ){
     $screen = get_current_screen();

     if  ( 'invoice' == $screen->post_type ) {
          $title = 'Enter Invoice Title';
     }

     return $title;
}

add_filter( 'enter_title_here', 'jk_change_default_title' );

This is the end result:

Here is the Trac discussion about this.


Reply

Andrew Rowland

January 17, 201111:32 pm

Makes me happy to see this…

Reply

Andrew Nacin

January 18, 20113:16 am

You also could have used the gettext filter (runs on all translations) in 3.0. But this does make it easier.

    Reply

    John Kolbert

    January 19, 20118:28 pm

    I’d not thought to use the gettext filter. Thanks for the tip!

Reply

Murali

January 29, 20116:52 am

i think , you can use gettext to change all of the post titles. I am not sure if you can use that for custom post type.

Reply

Mike

January 31, 20114:40 am

If you are executing admin function or class via your themes’ function.php you can assign this directly with jQuery .html() to the #title-prompt-text.
http://jhnk.pastebin.com/ev94uaNB

Reply

Pothi

March 2, 20117:58 am

Great tip. I wish you write more often. :)

Reply

Martin

March 12, 20116:57 pm

i had this problem sometimes ago, but then I sorted it out through one such post through google search, thanks for sharing such a nice piece of info with us.

Reply

Troy Peterson

March 15, 20116:00 pm

Ran into an issue with this, but found the problem.
When I added the code for the Custom Post type, it was causing problems with my admin_ajax in custom taxonomy.

It’s a simple fix though… simply add the filter above the function in the in your functions.php file:

http://jhnk.pastebin.com/UMT3RM2P

Reply

agabu

March 15, 20117:20 pm

Thanks a lot John. This is what I’ve been looking for today, just used for my custom post type and it worked great.

Reply

Nick

March 26, 20111:55 am

Great post! Thank you John!

Reply

The Frosty

April 18, 20114:51 pm

Awesome, sometimes I always forget to set the variable and return the original. Had to see it written out.

Thanks.

Reply

Paulo

May 1, 201110:16 am

Hi, great tip! I was looking for this and it helped. I wonder if there’s a function to add text (“how to”, “post rules”) to the post input field! Any help? Thank!

Reply

online hgh

May 11, 201111:17 am

my wish was always to learn wordpress completely but now i think that my dream will become true here by John Kolbert
Thanks Buddy

Reply

john

May 27, 20114:57 pm

quite interesting and lovely post, I like it, thanks a lot for sharing such a nice post with us.

Reply

lene

May 28, 201110:11 pm

This is really innovative and a new idea, I like this concept of yours and the way it is carried out in so light and cool manner. its really wonderful.

Reply

jim

May 29, 201110:13 am

Nice ideas discussed, I liked the way you shared your ideas so comprehensively. Thanks for sharing such a nice post.

Reply

Greg

July 28, 20114:37 am

Awesome! Thanks for this. I was looking for a way to change the title prompt for each different custom post type, and this just took all the work out of it for me. Saved me a boat load of time. Thanks John, and thanks google!

Reply

Kieran Malone

August 6, 201111:51 pm

Thank you! This saved me a good few anoying minutes

    Reply

    Kieran Malone

    August 6, 201111:51 pm

    Ill use those free minutes to work on my spelling…

Reply

agussudaryanto

August 22, 20118:29 am

thanks john, I liked the way you shared your ideas so comprehensively.

Reply

'Thomas

September 9, 20118:01 pm

Great post! Thank you John!

Reply

Ayoub

September 12, 201112:06 pm

Thank you :) works like a charm

Reply

Roxanne

September 15, 20113:37 am

Thanks so much! Exactly what I was after, but surprisingly hard to find in the Codex.

Reply

Plitvice

September 18, 20117:32 am

perfect!
thank you very much for the post!

Reply

Escorts

October 25, 201110:57 am

Awesome! Thanks for this.

Reply

Asad Wahab

November 1, 20116:31 pm

Thanks for such an informative and worth reading post, I would like to say a thanks for sharing an amazing post. Am specially impressed with your writing skills. Its really a nice article…

Reply

Andrea

November 11, 20118:23 pm

Hi John, thank´s a lot and greetz form Germany!

Reply

Alexander

December 2, 20116:42 pm

Thanks for guiding me, its really helpful for me

Reply

Leandro de Amorim

January 16, 20121:18 pm

Simplesmente útil. Thank you!

Reply

Brent Tilley

January 26, 20122:59 pm

Thanks for the useful tip!

Reply

pandikamal

February 2, 20122:28 pm

its awesome tips.

Reply

Sam

February 2, 20128:28 pm

Ah, beautiful. Works like a charm! Thanks.

Reply

Jan

February 15, 20128:31 pm

Thanks! That was very helpful for me at this moment! What a time saver!

Comment on this post:

License: By commenting you are granting me a perpetual, non-exclusive license to reproduce, paraphrase, and display your words, name, and/or website on this domain. All comments subject to moderation, editing, or deletion at my discretion.

Important: Unfortunately, I'm unable to offer support via comments. However, feel free to hire me.

Entering code?

(optional)