I'm trying to include the post title in a custom post type edit screen. For example if the post is called Biography, I want the edit page title to be 'Edit Biography'. I'm using the below code:

function my_post_register() {
 $mypagetitle = $post->post_title;
 $labels = array(
  'edit_item' => __('Edit '.$mypagetitle),

Why isn't this displaying the post title?

  • When are you calling this function? I can assume there is a timing issue here - shouldn't you already have registered your post type before you query for the post?
    – Jan Fabry
    Oct 1, 2010 at 7:41
  • Yeah I'm calling this before registering the post type. So I guess I need a way of changing the labels after the post type has been created?
    – fxfuture
    Oct 1, 2010 at 7:49
  • I would guess so. Look at the place in the PHP page that displays the title, and work backwards from there, to find the best place to edit the title and other labels, using a filter for example.
    – Jan Fabry
    Oct 1, 2010 at 8:11
  • I've found out it's this bit of code in post.php: $title = $post_type_object->labels->edit_item; but I've got no idea how to filter it!
    – fxfuture
    Oct 1, 2010 at 19:46
  • I don't remember exactly how it was at the time of asking, but this is definitely default behavior now. Oct 31, 2013 at 17:04

2 Answers 2


This will do it:

function edit_screen_title() {
    global $post, $title, $action, $current_screen;

    if( isset( $current_screen->post_type ) && $current_screen->post_type == 'post' && $action == 'edit' )
        $title = 'Edit ' . $post->post_title;

add_action( 'admin_head', 'edit_screen_title' );

two things I'd suggest. First try adding global $post as the first line in your function

global $post;

Also in places I've had trouble getting the post_title, then I found another function

$mypagetitle = single_post_title('', false);

You could try that - more details: http://codex.wordpress.org/Function_Reference/single_post_title

  • Thanks - I tried that but I think it's more of a timing issue as Jan suggests above
    – fxfuture
    Oct 1, 2010 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.