WordPress.org

Make WordPress Core

Ticket #47421: 47421.diff

File 47421.diff, 695 bytes (added by archduck, 13 months ago)

Strip fragments from url

  • functions.php

     
    742742        $post_links = apply_filters( 'enclosure_links', $post_links, $post_ID );
    743743
    744744        foreach ( (array) $post_links as $url ) {
     745
     746                $frag_test = @parse_url( $url );
     747                if ( isset( $frag_test['fragment'] ) ) {
     748                    $url = strip_fragment_from_url( $url );
     749                }
     750               
    745751                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 ) . '%' ) ) ) {
    746752
    747753                        $headers = wp_get_http_headers( $url );