Skip Navigation

[Resolved] Change “enter title here” text for custom post types

This thread is resolved. Here is a description of the problem and solution.

Problem:

Replace the "enter title here" placeholder text for a custom post type

Solution:

It needs custom codes, see the solution here:

https://toolset.com/forums/topic/change-enter-title-here-text-for-custom-post-types/#post-1079495

Relevant Documentation:

This support ticket is created 6 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by tylerG 6 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#1078742

I am trying to replace the "enter title here" placeholder text (hidden link) for a custom post type with the following snippet but it isn't working as expected:

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

if ( 'person-of-interest' == $screen->post_type ) {
$title = 'Enter the name of the person';
}

return $title;
}

add_filter( 'enter_title_here', 'change_default_title' );

Here is the custom post type info: hidden link

Any suggestions are much appreciated!

#1079495

Hello,

Please try to modify your PHP codes as below:

function change_default_title( $enter_title_here, $post ){
	
	if ( isset($post->post_type) && 'person-of-interest' == $post->post_type ) {
		$enter_title_here = 'Enter the name of the person';
	}

	return $enter_title_here;
}

add_filter( 'enter_title_here', 'change_default_title', 11, 2 );

And test again

#1079706

Works great! Thanks!