enclosure_links filter-hookWP 4.4.0

Filters the list of enclosure links before querying the database.

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


add_filter( 'enclosure_links', 'wp_kama_enclosure_links_filter', 10, 2 );

 * Function for `enclosure_links` filter-hook.
 * @param string[] $post_links An array of enclosure links.
 * @param int      $post_id    Post ID.
 * @return string[]
function wp_kama_enclosure_links_filter( $post_links, $post_id ){

	// filter...
	return $post_links;
An array of enclosure links.
Post ID.


Since 4.4.0 Introduced.

Where the hook is called

wp-includes/functions.php 938
$post_links = apply_filters( 'enclosure_links', $post_links, $post->ID );

Where the hook is used in WordPress

Usage not found.