• Hi,

    At https://www.murky.org/UKPoliBlog I have a syndicated site, (made of feeds)

    The issue is that & appears in the links, which invalidates the feeds for each column.

    The fix is to change & to &amp;, but as I don’t directly control the links this needs to be done automagically, ideally <?php permalink_single_rss(); ?> would have a filter which replaced & with &amp; in links (not replacing &amp; with &amp;amp; of course!)

    Does anyone know how I can achieve this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter murky

    (@murky)

    A fix… now, how do I submit this as a patch?

    In the file:

    feed-functions.php

    the permalink_single_rss() function needs updating:

    function permalink_single_rss($file = '') {
    $url = get_permalink();
    $url = str_replace("&", "&amp;", $url);
    $url = str_replace("&amp;amp;", "&amp;", $url);
    echo $url;
    }

    Now to find the error in the link to comment feeds….

    Thread Starter murky

    (@murky)

    In the file comment-functions.php

    function comments_link( $file = '', $echo = true ) {
    $url = get_comments_link();
    $url = str_replace("&", "&amp;", $url);
    $url = str_replace("&amp;amp;", "&amp;", $url);
    }

    Thread Starter murky

    (@murky)

    Finally, in feed-functions.php :

    function comments_rss($commentsrssfilename = '') {
    global $id;

    if ('' != get_settings('permalink_structure'))
    $url = trailingslashit( get_permalink() ) . 'feed/';
    else
    $url = get_settings('home') . "/$commentsrssfilename?feed=rss2&amp;p=$i
    d";
    $url = str_replace("&", "&amp;", $url);
    $url = str_replace("&amp;amp;", "&amp;", $url);

    return apply_filters('post_comments_feed_link', $url);
    }

    I’d really like to submit these as possible patches (if nothing else it’ll prevent recurrence in the future), any clues?

    Thread Starter murky

    (@murky)

    OOps, should have been:

    function comments_link( $file = '', $echo = true ) {
    $url = get_comments_link();
    $url = str_replace("&", "&amp;", $url);
    $url = str_replace("&amp;amp;", "&amp;", $url);
    echo $url;
    }

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘& in syndicated link’ is closed to new replies.