apply_filters( 'enter_title_here', string $text, WP_Post $post )

Filters the title field placeholder text.


Parameters

$text string
Placeholder text. Default 'Add title'.
$post WP_Post
Post object.

Top ↑

Source

File: wp-admin/edit-form-advanced.php. View all references

$title_placeholder = apply_filters( 'enter_title_here', __( 'Add title' ), $post );


Top ↑

Changelog

Changelog
Version Description
3.1.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by Saumya Majumder

    This filter is used to change the placeholder text of the Title field whether you are using the Classic Editor version or Gutenberg version. This works in both cases. This is really useful when you are creating a Custom Post Type (CPT).

    Let’s say you have a CPT called testimonials to add client testimonials in your site. But when you make the CPT the title field place holder will say “Enter title” instead maybe you wanna show “Enter Client Name” there. so you can do the following:

    if( is_admin() ) {
    	add_filter( 'enter_title_here', function( $input ) {
    		if( 'projects' === get_post_type() ) {
    			return __( 'Enter Project Name', 'textdomain' );
    		} else if ( 'testimonials' === get_post_type() ) {
    			return __( 'Enter Client\'s Name', 'textdomain' );
    		} else {
    			return $input;
    		}
    	} );
    }

You must log in before being able to contribute a note or feedback.