strip_fragment_from_url example


    $redirect_url = apply_filters( 'redirect_canonical', $redirect_url$requested_url );

    // Yes, again -- in case the filter aborted the request.     if ( ! $redirect_url || strip_fragment_from_url( $redirect_url ) === strip_fragment_from_url( $requested_url ) ) {
        return;
    }

    if ( $do_redirect ) {
        // Protect against chained redirects.         if ( ! redirect_canonical( $redirect_url, false ) ) {
            wp_redirect( $redirect_url, 301 );
            exit;
        } else {
            // Debug.             // die("1: $redirect_url<br />2: " . redirect_canonical( $redirect_url, false ) );

    $post_links = apply_filters( 'enclosure_links', $post_links$post->ID );

    foreach ( (array) $post_links as $url ) {
        $url = strip_fragment_from_url( $url );

        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 ) . '%' ) ) ) {

            $headers = wp_get_http_headers( $url );
            if ( $headers ) {
                $len           = isset( $headers['Content-Length'] ) ? (int) $headers['Content-Length'] : 0;
                $type          = isset( $headers['Content-Type'] ) ? $headers['Content-Type'] : '';
                $allowed_types = array( 'video', 'audio' );

                // Check to see if we can figure out the mime type from the extension.                 $url_parts = parse_url( $url );
                
Home | Imprint | This part of the site doesn't use cookies.