WordPress.org

Ready to get started?Download WordPress

Codex

Plugin API/Filter Reference/the title

Contents

Description

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 falsey value (e.g. NULL, FALSE or the empty string) from the filter function.

Parameters

$title
(string) (required) The post title
Default: None
$id
(int) (required) The post ID
Default: None

Examples

Suppressing the title in templates for all posts in the "blurb" category:

function suppress_if_blurb($title, $id) {
    if (in_category('blurb', $id)) {
        return '';
    }
    return $title;
}
add_filter('the_title', 'suppress_if_blurb', 10, 2);

Change Log

Source Files

This filter is applied by:

Related


This page is marked as incomplete. You can help Codex by expanding it.