WordPress will have some default placeholders for input fields, like the title text input, which defaults to ‘Enter title here’. Sometimes these can be a pain, as custom fields may have other fields that show titles or content, and the title field might just be used for reference. IT also looks a little better to have these fields customised sometimes, usually when dealing with custom posts. This is something very simple, but can go a long way, e.g. show ‘Enter case study title’ for a case study, or ‘Enter reviewer name’ for a feedback post type.
By adding in the following code, different input title placeholders can be set on a conditional basis. The simplest condition being the example used here; the current post type.
This function returns the WordPress “current screen object”, which allows us to retrieve information about the page that we are on, in this example we retrieve the post type.
The enter_title_here hook is used to update the title placeholder text.