I would like to change https:// to http:// in the enclosure tag

Issue #54 resolved
Jermaine Primus created an issue
  • I'm a nb at this so if I posted this in the wrong area, please let me know *

The site I'm working on has an SSL and subsequently the plugin I'm using makes nearly every page secure. I have found out that feeds don't validate if the enclosure tag is https://. See my example: Feed Validator

I have found a fix by including this script:

$VARIABLE = preg_replace("/^https:/i", "http:", $VARIABLE); 

The problem I'm having is not knowing where it should go.

I have tried the following:

podcast-feed.php Line ~75

<enclosure url="<?php $audio_file = preg_replace("/^https:/i", "http:", $audio_file); echo esc_url( $audio_file ); ?>" length="<?php echo $audio_file_size; ?>" type="audio/mpeg" />

podcast-functions.php Line ~77

    <?php if ( $audio == '' ) : ?> <?php // jp added: $audio = preg_replace("/^https:/i", "http:", $audio); ?>
    <!-- functions enclosure -->
    <enclosure url="<?php $audio = preg_replace("/^https:/i", "http:", $audio); echo $audio; ?>" length="0" type="audio/mpeg"/>

I have even tried editing this:

admin-functions.php Line ~77

    // jp added: $audio = preg_replace("/^https:/i", "http:", $audio);
    $audio = preg_replace("/^https:/i", "http:", $audio);
    do_enclose( $audio, $post_id );

Any help would be greatly appreciated.

Thank you.

Comments (1)

  1. Jermaine Primus reporter

    I was able to fix it by adding the following code to line 472 of wp-includes/feed.php:

                    $enclosure = preg_replace("/^https:/i", "http:", $enclosure); 
    

    I'm not fond of editing code from WordPress so, if anyone knows of a better fix, please let me know. Also, I'm not sure if I should submit this to WordPress or not (or even how to start to do that), however, if anyone else is interested there is the fix.

  2. Log in to comment