Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a plugin that unfortunately I have no control over, the problem I am experiencing is that it doesn't use & in place of & and so breaks the sites validation.

Is there a function I can use in my functions.php which will replace all instances of & with &?

After some investigation inside the plugin I have found the following snippet which is generating the invalid code....

    static function GetPermalink($incomingLink = null) {
        $blogUrl = get_bloginfo("url");
        $urlSlug = dsSearchAgent_Rewrite::GetUrlSlug();
        $canonicalUri = self::$CanonicalUri;

        if (isset($canonicalUri) && (!$incomingLink ||     preg_match("/dsidxpress-data/", $incomingLink)))
            return "{$blogUrl}/{$urlSlug}{$canonicalUri}";
        else
            return $incomingLink;
    }

It is the $canonicalURi variable that is holding the invalid link, am I right in thinking I need to apply the esc_attr to this variable?

share|improve this question
    
you've to filter esc_attr() function. let me know where you don't want & to appear. –  amit Aug 4 '12 at 9:25
    
Basically its a plugin that pulls in all of the post data from an external source. I have no way of controlling it. I was thinking maybe I would have to somehow scan through the page and dynamically replace them one by one? –  fightstarr20 Aug 4 '12 at 9:40
    
give link to plugin. –  amit Aug 4 '12 at 9:55
    
I have updated the original question with the snippet of code from the plugin –  fightstarr20 Aug 4 '12 at 22:08

1 Answer 1

It looks like the function returning an url, And is always good practice to use esc_url(); wordpress function to escape all characters including the - & into & before displaying.

Example usage -

return esc_url( $incomingLink );
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.