Change The Enter Title Text For Custom Post Types

Since discovering WordPress custom post types I've always wanted to customise the WordPress dashboard area. Your able to do this to a certain level by using labels on your custom post types. This will change where ever it says posts to the label of your custom post type.

Enter_text_here

But WordPress doesn't change the default Enter Title Here text, so if you create a new product custom post type then you can change the Enter Title Here to Enter New Product Here.

Add this to your functions.php file to change the Enter Title Here text.

function change_default_title( $title ){
     $screen = get_current_screen();
 
     if  ( $screen->post_type == 'product' ) {
          return 'Enter New Product Here';
     }
}
 
add_filter( 'enter_title_here', 'change_default_title' );

To change the title on normal default WordPress posts we can use the same function as above but can remove the check of the post type.

function title_text( $title ){
     return $title = 'Enter new title';
}
add_filter( 'enter_title_here', 'title_text' );

Advertise here 50% Off

Comment