I'm developing a child theme of a premium template, this comes with a custom post type with the label name of "Projects" but I'd like to change it to something else, I know that if I go to the functions.php file of the main theme I can change it easily but I'd like to change it from my child theme so I don't have to edit any of the original files, is it possible?

Thanks in advance!

1 Answer 1


There is a global array $wp_post_types. You can change $wp_post_types[$post_type]->labels after the parent theme has set the CPT.

So … if the parent theme registers the CPT on 'init' like this:

add_action( 'init', 'register_my_cpt', 12 );

Then you need a later priority:

add_action( 'init', 'change_cpt_labels', 13 );

… or a later hook. I would use wp_loaded:

add_action( 'wp_loaded', 'change_cpt_labels' );

Example for custom post type place changed to location

add_action( 'wp_loaded', 'wpse_19240_change_place_labels', 20 );

function wpse_19240_change_place_labels()
    $p_object = get_post_type_object( 'place' );

    if ( ! $p_object )
        return FALSE;

    // see get_post_type_labels()
    $p_object->labels->name               = 'Locations';
    $p_object->labels->singular_name      = 'Location';
    $p_object->labels->add_new            = 'Add location';
    $p_object->labels->add_new_item       = 'Add new location';
    $p_object->labels->all_items          = 'All locations';
    $p_object->labels->edit_item          = 'Edit location';
    $p_object->labels->name_admin_bar     = 'Location';
    $p_object->labels->menu_name          = 'Location';
    $p_object->labels->new_item           = 'New location';
    $p_object->labels->not_found          = 'No locations found';
    $p_object->labels->not_found_in_trash = 'No locations found in trash';
    $p_object->labels->search_items       = 'Search locations';
    $p_object->labels->view_item          = 'View location';

    return TRUE;
  • you beat me to it toscho. btw how do you pronounce your username. Commented Jun 5, 2011 at 4:45
  • @xLRDxREVENGEx I asked Google to make an audio file for me, and here you go.
    – fuxia
    Commented Jun 5, 2011 at 5:03
  • That is what i thought it would be. Commented Jun 5, 2011 at 5:05
  • 1
    @JeremyMiller See my update.
    – fuxia
    Commented Apr 19, 2013 at 7:11
  • 1
    @raddevon You can also use registered_post_type. See this example: wordpress.stackexchange.com/a/97530/73
    – fuxia
    Commented Jan 24, 2016 at 2:41

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.