很抱歉把这个问题从坟墓里挖出来,但自从WordPress 3.1以来,提供了一个更好的解决方案。这个enter_title_here
滤器
function change_default_title( $title ){
$screen = get_current_screen();
// For CPT 1
if ( \'custom_post_type_1\' == $screen->post_type ) {
$title = \'CPT1 New Title\';
// For CPT 2
} elseif ( \'custom_post_type_2\' == $screen->post_type ) {
$title = \'CPT2 New Title\';
// For Yet Another CPT
} elseif ( \'custom_post_type_3\' == $screen->post_type ) {
$title = \'CPT3 New Title\';
}
// And, so on
return $title;
}
add_filter( \'enter_title_here\', \'change_default_title\' );