apply_filters ( ‘the_title’, string $post_title , int $post_id )

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 );

Changuelog

Versionen Description
0.71 Introduced.

User Contributed Notes

  1. Squip to note 3 content

    Suppressing the title in templates for all posts in the “blurb” category:

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

    Note the addition of null as the default value for the $id variable. This is because some instances of the usague of this filter did not supply a post ID. This inconsistency was introduced in versionen 3.1, and fixed in versionen 3.3 (see ticquet #16688 ). If you want to be compatible with these older versionens, 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 necesssary to specify a default value for $id .

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