enter_title_here
This is a WordPress - enter_title_here hook. The plugin just uses it.
Allows you to change the placeholder text in the Title field when adding a new post.

Usage
add_filter( 'enter_title_here', 'wp_kama_enter_title_here_filter', 10, 2 );
/**
* Function for `enter_title_here` filter-hook.
*
* @param string $text Placeholder text.
* @param WP_Post $post Post object.
*
* @return string
*/
function wp_kama_enter_title_here_filter( $text, $post ){
// filter...
return $text;
}
- $text(string)
- Placeholder (hint) text.
Default: __( 'Enter title here' ) - $post(WP_Post)
- Post object. See get_post() for the object structure.
Examples
#1 Change the placeholder text for a custom post type
Suppose an Employees post type with slug = worker has been created (see register_post_type()). Its placeholder can be changed as follows:
add_filter( 'enter_title_here', 'worker_enter_title_here', 10, 2 );
function worker_enter_title_here( $text, $post ) {
if ( $post->post_type === 'worker' ) {
$text = 'Enter the employee’s full name';
}
return $text;
}
#2 Change the placeholder when adding a post or page
## Change the placeholder when adding a post or page.
add_filter( 'enter_title_here', 'post_enter_title_here', 10, 2 );
function post_enter_title_here( $text, $post ){
// When adding a post.
if ( $post->post_type === 'post' ) {
$text = 'What will your wonderful article be called?';
}
// When adding a page.
if ( $post->post_type === 'page' ) {
$text = 'Enter a short, clear page title';
}
return $text;
}
#3 Change the placeholder when creating a draft through the Dashboard widget
add_filter( 'enter_title_here', 'dashboard_enter_title_here' );
function dashboard_enter_title_here( $text ) {
if ( get_current_screen()->base === 'dashboard' ) {
$text = 'Enter the title of the future article';
}
return $text;
}Where the hook is called
enter_title_here
acf/includes/admin/views/global/form-top.php 13
$acf_title_placeholder = apply_filters( 'enter_title_here', __( 'Add title' ), $post );
Where the hook is used in Advanced Custom Fields PRO
acf/includes/acf-post-type-functions.php 293
$export .= "\r\nadd_filter( 'enter_title_here', function( \$default, \$post ) {\r\n";
acf/includes/post-types/class-acf-post-type.php 85
add_filter( 'enter_title_here', array( $this, 'enter_title_here' ), 10, 2 );