default_title

Filters the default post title initially used in the "Write Post" form.

Description

apply_filters( 'default_title', (string) $post_title, (WP_Post) $post ); 

Parameters (2)

0. $post_title (string)
Default post title.
1. $post (WP_Post)
Post object.

Usage

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

Defined (1)

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

/wp-admin/includes/post.php  
  1. $post->post_title = apply_filters( 'default_title', $post_title, $post );