Site icon WP Smith

How to Change the Title Text for Your Custom Post Type

Understanding WordPress Custom Post Types

Have you ever wanted to use the Title section, but didn't want to call it Title? Surely, many of you have wanted to change the text in the title entry bar from the standard 'Enter title here' to something more specific for your custom post type. Well, WordPress has a filter for it.

[php]<?php
// Change 'Enter Title Here' text for a CPT
function wps_change_default_title( $title ){
$screen = get_current_screen();
$wps_cpt = 'wps_mycpt';

if ( $wps_cpt == $screen->post_type ) {
$title = 'Enter Staff Members Name Here'; //change this to whatever you'd like
}

return $title;
}

add_filter( 'enter_title_here', 'wps_change_default_title' );
[/php]