enclosure_links

Filters the list of enclosure links before querying the database.

Description

apply_filters( 'enclosure_links', (array) $post_links, (int) $post_id ); 

Allows for the addition and/or removal of potential enclosures to save to postmeta before checking the database for existing enclosures.

Parameters (2)

0. $post_links (array)
An array of enclosure links.
1. $post_id (int)
The post id.

Usage

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

Defined (1)

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

/wp-includes/functions.php  
  1. $post_links = apply_filters( 'enclosure_links', $post_links, $post_ID );