WordPress Screens 'Type title here' placeholder text in the title field when you create a new post. Recently one of our users asked if they could replace it with their own placeholder text. This is particularly useful when you are using custom post types or creating a custom CMS for clients. In this article, we will show you how to replace the 'Enter Title Here' text in WordPress.
If you don't like the video or need more instructions, continue reading.
Let's say you've created a custom post type to create personal profiles, and you want the person's name to be used as the title. By replacing the placeholder text, you can instruct users to use this field to enter the name.
You can create any type of content, and there's no reason why you should use generic text when you can make it more useful to users.
All you need to do is add this code to your theme's functions.php file or a site-specific plugin.
función wpb_change_title_text ($ title) $ screen = get_current_screen (); if ('movie' == $ screen-> post_type) $ title = 'Ingrese el nombre de la película con el año de lanzamiento'; devolver $ título; add_filter ('enter_title_here', 'wpb_change_title_text');
Don't forget to replace 'movies' with your own custom post type, and the text with your own custom text.
Let's explain the code. First we create a function. wpb_change_title_text
. Inside the function, we add a check to see if the user is on a particular custom post type screen.
When it detects that a user is on that particular custom post type screen, it should return our custom title text. After that, we simply hook our function to the enter_title_here filter which allows you to change the default title text.
That's it, now you can create a new post in your custom post type and you will see your own custom placeholder text in the title field.
We hope this article helped you replace the 'Enter Title Here' text in the WordPress post editor. You can also refer to our guide on how to add default content in the WordPress post editor.
If you enjoyed this article, please subscribe to our WordPress YouTube Channel video tutorials. You can also find us on Twitter and Google.+.
Source:Paulund