get_enclosed

The timeline below displays how wordpress function get_enclosed has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Retrieves enclosures already enclosed for a post.
 *
 * @since 1.5.0
 *
 * @param int $post_id Post ID.
 * @return string[] Array of enclosures for the given post.
 */
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);
}

WordPress Version: 5.5

/**
 * Retrieve enclosures already enclosed for a post.
 *
 * @since 1.5.0
 *
 * @param int $post_id Post ID.
 * @return string[] Array of enclosures for the given post.
 */
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);
}

WordPress Version: 5.4

/**
 * Retrieve enclosures already enclosed for a post.
 *
 * @since 1.5.0
 *
 * @param int $post_id Post ID.
 * @return string[] Array of enclosures for the given post.
 */
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);
}

WordPress Version: 4.6

/**
 * Retrieve enclosures already enclosed for a post.
 *
 * @since 1.5.0
 *
 * @param int $post_id Post ID.
 * @return array List of enclosures.
 */
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);
}

WordPress Version: 4.3

/**
 * Retrieve enclosures already enclosed for a post.
 *
 * @since 1.5.0
 *
 * @param int $post_id Post ID.
 * @return array List of enclosures.
 */
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]);
        }
    }
    /**
     * Filter 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);
}

WordPress Version: 4.0

/**
 * Retrieve enclosures already enclosed for a post.
 *
 * @since 1.5.0
 *
 * @param int $post_id Post ID.
 * @return array List of enclosures.
 */
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]);
        }
    }
    /**
     * Filter 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.
     */
    $pung = apply_filters('get_enclosed', $pung, $post_id);
    return $pung;
}

WordPress Version: 3.9

/**
 * Retrieve enclosures already enclosed for a post.
 *
 * @since 1.5.0
 *
 * @param int $post_id Post ID.
 * @return array List of enclosures
 */
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]);
        }
    }
    /**
     * Filter 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.
     */
    $pung = apply_filters('get_enclosed', $pung, $post_id);
    return $pung;
}

WordPress Version: 3.7

/**
 * Retrieve enclosures already enclosed for a post.
 *
 * @since 1.5.0
 *
 * @param int $post_id Post ID.
 * @return array List of enclosures
 */
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]);
        }
    }
    $pung = apply_filters('get_enclosed', $pung, $post_id);
    return $pung;
}