Description
Filters the auto generated post excerpt, if auto excerpts are being used.
Comes at the end of the process, after the $content variable has been truncated. The auto excerpt will be the number of words specified in the plugin options plus the “more” link.
Parameters
$content
(string) (required) The autogenerated excerpt.
$post_id
(int) (optional) The post ID.
$post_type
(strong) (optional) The WordPress post type of the current post.
Return
$content
(string) (required) The excerpt.
Example
add_filter( 'wpmem_auto_excerpt', function( $content, $post_id, $post_type ) {
global $post;
return get_the_excerpt( $post );
// Alternative method if $post is not the current post object.
// return get_the_excerpt( get_post( $post_id ) );
}, 10, 3);Changelog
- Introduced 2.8.1
- 3.0.9 Added post ID and post type parameters.
- 3.2.5 Post ID and post type may be false if there is no post object.
Source
wpmem_auto_excerpt is located in /includes/class-wp-members.php