bp_excerpt_length
Filters the excerpt length to trim text to.
Description
Parameters (1)
- 0. $length (int)
- Length of returned string, including ellipsis.
Usage
- To run the hook, copy the example below.
- $length = apply_filters( 'bp_excerpt_length', $length );
- if ( !empty( $length ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the bp_excerpt_length callback
- function filter_bp_excerpt_length( $length ) {
- // make filter magic happen here...
- return $length;
- };
- // add the filter
- add_filter( 'bp_excerpt_length', 'filter_bp_excerpt_length', 10, 1 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'bp_excerpt_length', 'filter_bp_excerpt_length', 10, 1 );
Defined (1)
The filter is defined in the following location(s).
- /bp-core/bp-core-template.php
- $length = apply_filters( 'bp_excerpt_length', $length );