Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: enclosure_links

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
593       *
594       * Allows for the addition and/or removal of potential enclosures to save
595       * to postmeta before checking the database for existing enclosures.
596       *
597       * @since 4.4.0
598       *
599       * @param array $post_links An array of enclosure links.
600       * @param int   $post_ID    Post ID.
601       */
602      $post_links = apply_filters( 'enclosure_links', $post_links, $post_ID );
603
604      foreach ( (array) $post_links as $url ) {
605           if ( $url != '' && !$wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like( $url ) . '%' ) ) ) {
606
607                if ( $headers = wp_get_http_headers( $url) ) {
608                     $len = isset( $headers['content-length'] ) ? (int) $headers['content-length'] : 0;
609                     $type = isset( $headers['content-type'] ) ? $headers['content-type'] : '';
610                     $allowed_types = array( 'video', 'audio' );
611