Change WordPress Post Title Placeholder

I’m Creating a custom post type and want to manipulate the placeholder text within the title field of the Create New Post section.

Requirements:
– It can only be for one specific post type, not for all posts.
– It cannot reflect the name of the post type, it must be completely custom text.
– It does not have to be editable from the wordpress admin section, the custom text can be placed within the function in the functions.php file.

Related posts

Leave a Reply

2 comments

  1. You can place this snippet in your functions.php

    function change_default_title( $title ){
    
    $screen = get_current_screen();
    
    if ( 'your_custom_post_type' == $screen->post_type ){
    $title = 'Your custom placeholder text';
    }
    
    return $title;
    }
    
    add_filter( 'enter_title_here', 'change_default_title' );
    

    That should change the titel.

    found on: https://gist.github.com/FStop/3094617

  2. You can also used this for multiple post types

    add_filter('enter_title_here', 'my_title_place_holder' , 20 , 2 );
        function my_title_place_holder($title , $post){
            // For Activities
        if( $post->post_type == 'activities' ){
            $my_title = "Activity Name";
                    return $my_title;
        }
            // For Instructors
        elseif( $post->post_type == 'instructors' ){
                $my_title = "Instructor Name";
                    return $my_title;
        }
    
        return $title;
            }