apply_filters( "post_type_labels_{$post_type}", object $labels )

Filters the labels of a specific post type.


Description Description

The dynamic portion of the hook name, $post_type, refers to the post type slug.

See also See also


Top ↑

Parameters Parameters

$labels

(object) Object with labels for the post type as member variables.


Top ↑

Source Source

File: wp-includes/post.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
3.5.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by slushman

    If you need to modify the post type labels, note the labels parameter for this filter is an object, not an array.

    In the example below, the post type is “employee” and the new label reference is “headshot”.

    /**
     * Changes strings referencing Featured Images for a post type
     * 
     * @param 		object 		$labels 		Current post type labels
     * @return 		object 					Modified post type labels
     */
    function change_featured_image_labels( $labels ) {
    
    	$labels->featured_image 	= 'Headshot';
    	$labels->set_featured_image 	= 'Set headshot';
    	$labels->remove_featured_image 	= 'Remove headshot';
    	$labels->use_featured_image 	= 'Use as headshot';
    
    	return $labels;
    
    } // change_featured_image_labels()
    
    add_filter( 'post_type_labels_employee', 'change_featured_image_labels', 10, 1 );

You must log in before being able to contribute a note or feedback.