How to Replace “Add Title” Placeholder Text in WordPress?

0
194

Do you want to learn the way to replace “Add title” placeholder text in WordPress?

By default, WordPress shows the “Add title” placeholder at the top while creating a page or post. In addition to this, displaying other text might be more useful than simply displaying add title.

In this tutorial, you will guide you to replace the “Add title” placeholder in WordPress in the easiest and most quick manner. 

Reason to Replace “Add Title” Placeholder Text:

While creating a new page or post you might have noticed the prompt “Add title” at the top of the page. This is found in the classic editor as well as the block editor. The main motive of the placeholder text “Add title” is to provide you with a path to begin the post.

Replace "Add Title" Placeholder Text in WordPress.

Additionally, you need to replace “Add title” when you are creating a custom CMS for clients or using custom post types. You can simply change it into something less generic. For instance, say you are working on the post to display the publication of the books, you want your user to enter the book name as the title.

 You can merely replace a placeholder so that it guides the user to write the book’s name rather than their own as the title. Moving forward towards the replacing placeholder in WordPress:

Steps to Replace “Add Title” Placeholder Text in WordPress

In order to replace the text holder all you need to do is add a code snippet to your theme’s function.php file. Before you add a code snippet make sure you are working on the child theme as a small error can break down the entire system.

If this is your first time do visit our article “How to Easily Add Custom Code in WordPress?” for detailed information about adding code. Now, copy the code mentioned below and paste it into your theme’s function.php file or a site-specific plugin:

function wpb_change_title_text( $title ){

     $screen = get_current_screen();

     if  ( ‘book’ == $screen->post_type ) {

          $title = ‘Enter book name with writer name’;

     }

     return $title;

}

add_filter( ‘enter_title_here’, ‘wpb_change_title_text’ );

Replace "Add Title" Placeholder Text in WordPress.

Do replace “book” with your own custom post type, and the text “Enter book name with writer” with your own text. The significant part of this code is it works perfectly for classic and block editions. 

Don’t forget to save the changes. Thus, you have replaced the “Add title” placeholder text in WordPress.

Replace "Add Title" Placeholder Text in WordPress.

Wrapping up

We hope this tutorial helped you to replace the placeholder text in WordPress. If you loved this tutorial follow our other tutorial “How to Install a WordPress Child Theme?” for more information about WordPress!

LEAVE A REPLY

Please enter your comment!
Please enter your name here