WordPress displays ‘Enter title here’ placeholder text in the title field when you create a new post. Recently one of our users asked if they can 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 ‘Enter title here’ text in WordPress.
Video Tutorial
If you don’t like the video or need more instructions, then continue reading.
When and Why You Need to Replace Title Placeholder Text?
Let’s say you have 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 is no reason why you should be using a generic text when you can make it more helpful for users.
Replacing The Title Placeholder Text in WordPress
All you need to do is add this code in your theme’s functions.php file or a site-specific plugin.
function wpb_change_title_text( $title ){ $screen = get_current_screen(); if ( 'movie' == $screen->post_type ) { $title = 'Enter movie name with release year'; } return $title; } 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 us explain the code. First we created a function wpb_change_title_text
. Inside the function, we added 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, then it should return our custom title text. After that we simply hooked our function to the enter_title_here filter which allows you to change the default title text.
That’s all, you can now create a new entry 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 ‘Enter title here’ text in WordPress post editor. You may also want to check out our guide on how to add default content in WordPress post editor.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Google+.
Source: Paulund
Really.. great tutorial. It has helpmed a lot. I have small question. how to change “Title” column to my “custom colomn” in custom post type list and i want to give edit option for that custom column as like “title”. I have been to google about this, it has been found that, by default “Title” comes with “Edit, Trash” etc links. but I want to change “title” to custom column with same edit, trash columns. Thanks in advance.
This is great.
I always wondered if this was possible.
Is there a plugin that can do this?
You can call PHP scripts by using PHP include, require and require_once functions.
This is pretty easy to fix, nice one.
I have a quick question regarding the functions.php. I’ve seen people adding functions in separate .php files in their “inc” folder of their theme. To this day I’m unsure on how to link these other files into the functions.php. Any idea?
Great! Easy, but really nice usability fix for dummy clients ^^! Thank you guys
Very nice! I was just contemplating how to do this for a plugin before I went to bed last night. You guys just made my day a lot better!