Skip Navigation

[Résolu] Change « enter title here » text for custom post types

Ce fil est résolu. Voici une description du problème et la solution proposée.

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 Il y a 5 années et 8 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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)

Marqué : 

This topic contains 2 réponses, has 2 voix.

Last updated by tylerG Il y a 5 années et 8 mois.

Assisted by: Luo Yang.

Auteur
Publications
#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!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.