A WordPress-centric search engine for devs and theme authors



get_enclosed ›

Since1.5.0
Deprecatedn/a
get_enclosed ( $post_id )
Parameters:
  • (int) $post_id Post ID.
    Required: Yes
Returns:
  • (array) List of enclosures.
Defined at:
Codex:

Retrieve enclosures already enclosed for a post.



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 array $pung    Array of enclosures for the given post.
	 * @param int   $post_id Post ID.
	 */
	return apply_filters( 'get_enclosed', $pung, $post_id );
}