WPIntell

Source evidence

Breaks WPML & Google site index

Root Relative URLs · support · 2013-05-28T13:00:00+00:00

complaintsentiment
highseverity
0.97relevance
0replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

5 / 35 rows with source links

14.3% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

30 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
JarOfJam unresolved
Hi! Great plugin, but I seem to have problems with WPML language selector dropdown menu. Apparently the URLs which are being generated by get_ls_languages() in WPML are being trimmed by get_permalink prior WPML tries to replace domains on links which are already relative, producing all selector links as relative. The same applies to: <link rel="alternate" hreflang="en-NL" href="http://www.domain.nl/" /> links in the header. Our solution, though very nasty, is as follows: diff --git a/wp-content/plugins/sitepress-multilingual-cms/menu/language-selector.php b/wp-content/plugins/sitepress-multilingual-cms/menu/language-selector.php --- a/wp-content/plugins/sitepress-multilingual-cms/menu/language-selector.php +++ b/wp-content/plugins/sitepress-multilingual-cms/menu/language-selector.php @@ -54,7 +54,7 @@ <ul> <?php foreach($active_languages as $lang): ?> <li class="icl-<?php echo $lang['language_code'] ?>"> - <a onclick="_gaq.push(['_link', this.href]); return false;" rel="alternate" hreflang="<?php echo $this->get_locale($lang['language_code']) ?>" href="<?php echo apply_filters('WPML_filter_link', $lang['url'], $lang)?>"> + <a onclick="_gaq.push(['_link', this.href]); return false;" rel="alternate" hreflang="<?php echo $this->get_locale($lang['language_code']) ?>" href="<?php echo $lang['url'] ?>"> <?php if( $this->settings['icl_lso_flags'] || $icl_language_switcher_preview):?> <img <?php if( !$this->settings['icl_lso_flags'] ):?>style="display:none"<?php endif?> class="iclflag" src="<?php echo $lang['country_flag_url'] ?>" alt="<?php echo $this->get_locale($lang['language_code']) ?>" /> <?php endif; ?> diff --git a/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php b/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php --- a/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php +++ b/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php @@ -4992,6 +4992,21 @@ $w_active_languages[$k]['active'] = $this->get_current_language()==$lang_code?'1':0;; } + $t = array( + 'ca' => 'http://www.domain.ca', + 'au' => 'http://www.domain.com.au', + 'gb' => 'http://www.domain.co.uk', + 'hk' => 'http://www.domain.com.hk', + 'nl' => 'http://www.domain.nl', + 'en' => 'http://www.domain.com' + ); + foreach($w_active_languages as $k=>$v){ + $temp = parse_url($w_active_languages[$k]['url']); + $w_active_languages[$k]['url'] = $t[$k] . $temp['path']; + if (array_key_exists('query', $temp)) { + $w_active_languages[$k]['url'] .= '?' . $temp['query']; + } + } // restore current $wp_query unset($wp_query); $wp_query = clone $_wp_query_back; Furthermore, when using your plugin, Simple Google Sitemap XML plugin produces a sitemap which only has relative URLs repeated multiple times (6 in our case as we have 6 domains) I know it’s not something you can fix (apart from perhaps introducing a utility function such as get_permalink_absolute where users could modify the broken plugins), but just wanted to post this in case some other people are struggling with a similar issue. http://wordpress.org/extend/plugins/root-relative-urls/

Comments

0 shown

No comments were stored for this source.