[Plugin: WordPress SEO by Yoast] changed get_bloginfo() to get_bloginfo_rss()
-
hi there.
I have 5 domains pointing to the same server. the domain names are important because people find it easier to remember a certain domain depending on their native language.
I’ve written filter code to translate links in my site to root-relative links. so far, it seems to be working really well, but it did cause a problem with WPSEO’s
%%BLOGLINK%%
in the RSS feeds.my filters work in 6 different places, including
site_url()
andhome_url()
whichget_bloginfo()
now uses to return those items. this works fine everywhere except where WPSEO tries to generate the %%BLOGLINK%% value.I could have manually specified the full href value in WPSEO’s settings but I did this, for now:
in WPSEO/frontend/class-frontend.php::rss_replace_vars(), specifically for the $bloglink assignment statement, I changed get_bloginfo() to get_bloginfo_rss(). that allowed me to build one more filter specifically for url’s headed for rss feeds.
function gregory_set_domain_in_rss_urls( $info, $show ) {<br /> // copied from wp-includes/general-template.php::get_bloginfo()<br /> $url = true;<br /> if (strpos($show, 'url') === false &&<br /> strpos($show, 'directory') === false &&<br /> strpos($show, 'home') === false)<br /> $url = false;</p> <p> return ( !$url || !empty($info) ? $info : get_option('home') );<br /> }<br /> add_filter( 'get_bloginfo_rss', 'gregory_set_domain_in_rss_urls', 11, 2 );<br />
might it be possible for WPSEO to use get_bloginfo_rss() wherever the feeds are concerned? using absolute links in feeds might be preferable to root-relative links.
btw, your ‘wpseo_canonical’ filter hook allowed me to set the exact same domain for every article’s canonical link; i.e., all 5 domains point to the same canonical link.
cheers,
Gregory
- The topic ‘[Plugin: WordPress SEO by Yoast] changed get_bloginfo() to get_bloginfo_rss()’ is closed to new replies.