default_excerpt

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

Description

apply_filters( 'default_excerpt', (string) $post_excerpt, (WP_Post) $post ); 

Parameters (2)

0. $post_excerpt (string)
Default post excerpt.
1. $post (WP_Post)
Post object.

Usage

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

Defined (1)

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

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