get_enclosed( int $post_id ): string[]
- Since
- 1.5.0
- Source
wp-includes/post.php:5978
Retrieves enclosures already enclosed for a post.
Parameters
$post_idint- Post ID.
Return
string[]- Array of enclosures for the given post.
Hooks fired · 1
One hook fires while get_enclosed() runs, in this order:
- apply_filters( get_enclosed )filterline 6003 (+25 into the body)
Filters the list of enclosures already enclosed for the given post.
Uses · 2
- get_post_custom()Retrieves post meta fields, based on post ID.
- apply_filters()Calls the callback functions that have been added to a filter hook.
Used by · 1
- do_enclose()Checks content for video and audio links to add as enclosures.
Source
function get_enclosed( $post_id ) { $custom_fields = get_post_custom( $post_id ); $pung = array(); if ( ! is_array( $custom_fields ) ) { return $pung; } foreach ( $custom_fields as $key => $val ) { if ( 'enclosure' !== $key || ! is_array( $val ) ) { continue; } foreach ( $val as $enc ) { $enclosure = explode( "\n", $enc ); $pung[] = trim( $enclosure[0] ); } } /** * Filters the list of enclosures already enclosed for the given post. * * @since 2.0.0 * * @param string[] $pung Array of enclosures for the given post. * @param int $post_id Post ID. */ return apply_filters( 'get_enclosed', $pung, $post_id );}History
Introduced in 1.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.9.7 tag, from
src/wp-includes/post.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.