Skip to content

Instantly share code, notes, and snippets.

@mrbobbybryant
Last active August 29, 2015 14:14
Show Gist options
  • Save mrbobbybryant/742dd80725c95da96b57 to your computer and use it in GitHub Desktop.
Save mrbobbybryant/742dd80725c95da96b57 to your computer and use it in GitHub Desktop.
Change the default WordPress title placeholder text
<?php
//If you only need to change one use this version.
function dwwp_change_title( $title_placeholder) {
$screen = get_current_screen();
if ( $screen->post_type == 'job' ) { //<--Your post type name goes here.
$title_placeholder = 'I changed the title yo';
}
return $title_placeholder;
}
add_filter( 'enter_title_here', 'dwwp_change_title' );
//To change multiple placeholder titles, a switch statement is better.
function dwwp_change_title( $title_placeholder) {
$screen = get_current_screen();
switch ($title_placeholder) {
case ( $screen->post_type == 'metabox' ):
return $title_placeholder = 'metabox title';
break;
case ( $screen->post_type == 'job' ):
return $title_placeholder = 'job title';
break;
default:
return $title_placeholder;
}
}
add_filter( 'enter_title_here', 'dwwp_change_title' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment