the_title

This filter is documented in wp-includes/post-template.php.

Description

apply_filters( 'the_title', (string) $item_name, (int) $int ); 

Parameters (2)

0. $item_name (string)
Item text to be applied.
1. $int (int)
Post ID the title is for.

Usage

To run the hook, copy the example below.
  1. $item_name = apply_filters( 'the_title', $item_name, $int ); 
  2.  
  3. if ( !empty( $item_name ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the the_title callback 
  2. function filter_the_title( $item_name, $int ) { 
  3. // make filter magic happen here... 
  4. return $item_name
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'the_title', 'filter_the_title', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'the_title', 'filter_the_title', 10, 2 ); 

Defined (4)

The filter is defined in the following location(s).

/bp-core/classes/class-bp-walker-nav-menu.php  
  1. $item_output .= $args->link_before . apply_filters( 'the_title', $item->name, 0 ) . $args->link_after; 
/bp-blogs/bp-blogs-template.php  
  1. $retval = sprintf( __( 'Latest Post: %s', 'buddypress' ), '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval ) . '</a>' ); 
  1. $retval = '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval ) . '</a>'; 
/bp-activity/bp-activity-embeds.php  
  1. $caption .= sprintf( '<a rel="nofollow" href="%1$s" onclick="top.location.href=\'%1$s\'">%2$s</a>', esc_url( $url ), apply_filters( 'the_title', $anchor_text ) );