Change ‘Enter Title Here’ Text in WordPress 3.1

Change ‘Enter Title Here’ Text in WordPress 3.1

Change ‘Enter Title Here’ Text in WordPress 3.1

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:

1
2
3
4
5
6
7
8
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’.

01
02
03
04
05
06
07
08
09
10
11
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:

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:

[siteorigin_widget class=”WP_Widget_Media_Image”][/siteorigin_widget]

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:

1
2
3
4
5
6
7
8
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’.

01
02
03
04
05
06
07
08
09
10
11
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' );
[siteorigin_widget class=”WP_Widget_Media_Image”][/siteorigin_widget]

Leave a Reply

Your email address will not be published. Required fields are marked *