When we create a custom post and click Add New Post,we see everything same at the admin end. For example you added a new custom post Team. So instead of “Enter Title Here” on the Title section you want to show “Name of Team Member”. How can we do that.
First you have a create a custom post as I create a custom post Team. get_current_screen() is a function that is used for get the current screen object. I create a function change_default_title() and use get_current_screen() function inside it. And finally filtering the function by use add_filter. At the first parameter ‘enter_title_here’ is the current version. And you can change it by add the function name at the second parameter.
// Change default Title function change_default_title( $title ){ $screen = get_current_screen(); // For Team if ( 'team' == $screen->post_type ) { $title = 'Name of Team Member'; } return $title; } add_filter( 'enter_title_here', 'change_default_title' );
When you want to change ‘Enter Title Here’ in multiple custom posts. You can use like this.
// Change default Title function change_default_title( $title ){ $screen = get_current_screen(); // For Testimonials if ( 'testimonials' == $screen->post_type ) { $title = 'Customer Name'; // For Services } elseif ( 'services' == $screen->post_type ) { $title = 'Service Name'; // For Projects } elseif ( 'projects' == $screen->post_type ) { $title = 'Project Name'; } // For Slider elseif ( 'slider' == $screen->post_type ) { $title = 'Slider Heading'; } // For Team elseif ( 'team' == $screen->post_type ) { $title = 'Name of Team Member'; } return $title; } add_filter( 'enter_title_here', 'change_default_title' );
Hope this tutorial works. Thanks !