I want to change the default placeholder text in my Custom Post Type title field. This isn’t possible while registering a new post type.

The following screenshot describes it.

Screen from WP Admin

2 Answers
2

I use a code which differs from yours a little bit. There is no need to get the current screen using the enter_title_here-filter because you have already a post-object:

/**
 * Filter: Modifies the standard placeholder text
 * @param string $title
 * @param WP_Post $post
 * @return string
 */
function my_enter_title_here( $title, $post ) {
    if ( 'POST_TYPE' == $post->post_type ) {
        $title="Custom placeholder text here";
    }
    return $title;
}
add_filter( 'enter_title_here', 'my_enter_title_here', 10, 2 );

Leave a Reply

Your email address will not be published. Required fields are marked *