Filters the post title.
Parameters
$post_title
string- The post title.
$post_id
int- The post ID.
More Information
the_title
is a filter applied to the post title retrieved from the database, prior to printing on the screen. In some cases (such as when the_title is used), the title can be suppressed by returning a false value (e.g. NULL
, FALSE
or the empty string) from the filter function.
Source
return apply_filters( 'the_title', $post_title, $post_id );
Related
Used by | Description |
---|---|
WP_REST_Menu_Items_Controller::prepare_item_for_response()wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Prepares a single post output for response. |
WP_REST_Templates_Controller::prepare_item_for_response()wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Prepare a single template output for response |
WP_Customize_Nav_Menu_Item_Setting::get_original_title()wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Get original title. |
WP_Posts_List_Table::column_title()wp-admin/includes/class-wp-posts-list-table.php | Handles the title column output. |
Walker_Nav_Menu_Checklist::start_el()wp-admin/includes/class-walker-nav-menu-checklist.php | Start the element output. |
wp_get_archives()wp-includes/general-template.php | Displays archive links based on type and format. |
get_boundary_post_rel_link()wp-includes/deprecated.php | Get boundary post relational link. |
get_parent_post_rel_link()wp-includes/deprecated.php | Get parent post relational link. |
previous_post()wp-includes/deprecated.php | Prints a link to the previous post. |
next_post()wp-includes/deprecated.php | Prints link to the next post. |
get_adjacent_post_link()wp-includes/link-template.php | Retrieves the adjacent post link. |
Walker_Nav_Menu::start_el()wp-includes/class-walker-nav-menu.php | Starts the element output. |
Walker_Page::start_el()wp-includes/class-walker-page.php | Outputs the beginning of the current element in the tree. |
get_the_title()wp-includes/post-template.php | Retrieves the post title. |
wp_setup_nav_menu_item()wp-includes/nav-menu.php | Decorates a menu item object with the shared navigation menu item properties. |
do_trackbacks()wp-includes/comment.php | Performs trackbacks. |
Changelog
Version | Description |
---|---|
0.71 | Introduced. |
Suppressing the title in templates for all posts in the “blurb” category:
Note the addition of
null
as the default value for the$id
variable. This is because some instances of the usage of this filter did not supply a post ID. This inconsistency was introduced in version 3.1, and fixed in version 3.3 (see ticket #16688). If you want to be compatible with these older versions, you need to supply the default value as above, or you will end up with a PHP warning stating that you are missing an argument. If you don’t need to support 3.1 or 3.2, it isn’t necessary to specify a default value for$id
.Render capitalised post titles across your site like so: