Snippet: Change default ‘Enter Title Here’ for custom post types

Add following snippet to “functions.php”

Snippet

add_filter( 'enter_title_here', 'change_default_title' );
function change_default_title( $title ){
     $screen = get_current_screen();
     switch($screen->post_type) {
     	case 'post':
        	$title = 'Please Specify Post Title';
            break;
     }
     return $title;
}

Result

It will change the default hover title (‘Enter Title Here’) to the ‘Please Specify Post Title’.

+1

You can use the same code to make it work with the custom post types. Just add another case with the custom type and specify its title.

<pre>switch($screen->post_type) {
   case 'post':
       	$title = 'Please Specify Post Title';
         break;
   case 'article':
       	$title = 'Please Specify Article Title';
         break;
}</pre>

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>