bp_media_extractor_extract

Filters media extracted from text.

Description

apply_filters( 'bp_media_extractor_extract', (array) $media, (string) $richtext, (int) $what_to_extract, (array) $extra_args, (string) $plaintext ); 

Parameters (5)

0. $media (array)
Extracted media. See for format.
1. $richtext (string)
Content to parse.
2. $what_to_extract (int)
Media type to extract.
3. $extra_args (array)
Bespoke data for a particular extractor.
4. $plaintext (string)
Copy of $richtext without any markup.

Usage

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

Defined (1)

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

/bp-core/classes/class-bp-media-extractor.php  
  1. return apply_filters( 'bp_media_extractor_extract', $media, $richtext, $what_to_extract, $extra_args, $plaintext );