the_title

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

Description

apply_filters( 'the_title', (string) $title, (int) $id ); 

Parameters (2)

0. $title (string)
The post title.
1. $id (int)
The post ID.

Usage

To run the hook, copy the example below.
  1. $title = apply_filters( 'the_title', $title, $id ); 
  2.  
  3. if ( !empty( $title ) ) { 
  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( $title, $id ) { 
  3. // make filter magic happen here... 
  4. return $title
  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 (14)

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

/wp-includes/post-template.php  
  1. return apply_filters( 'the_title', $title, $id ); 
/wp-includes/nav-menu.php  
  1. $original_title = apply_filters( 'the_title', $original_object->post_title, $original_object->ID ); 
/wp-includes/link-template.php  
  1. $title = apply_filters( 'the_title', $title, $post->ID ); 
/wp-includes/general-template.php  
  1. $text = strip_tags( apply_filters( 'the_title', $result->post_title, $result->ID ) ); 
/wp-includes/deprecated.php  
  1. $string .= apply_filters('the_title', $post->post_title, $post->ID); 
  1. $string .= apply_filters('the_title', $post->post_title, $post->ID); 
  1. $title = apply_filters('the_title', $title, $post->ID); 
  1. $title = apply_filters('the_title', $title, $post->ID); 
/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php  
  1. $original_title = apply_filters( 'the_title', $original_object->post_title, $original_object->ID ); 
/wp-includes/comment.php  
  1. $post_title = apply_filters( 'the_title', $post->post_title, $post->ID ); 
/wp-includes/class-walker-page.php  
  1. apply_filters( 'the_title', $page->post_title, $page->ID ), 
/wp-includes/class-walker-nav-menu.php  
  1. $title = apply_filters( 'the_title', $item->title, $item->ID ); 
/wp-admin/includes/class-wp-posts-list-table.php  
  1. $parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID ); 
/wp-admin/includes/class-walker-nav-menu-checklist.php  
  1. $title = apply_filters( 'the_title', $item->post_title, $item->ID );