Title: Custom menu links bug
Last modified: August 21, 2016

---

# Custom menu links bug

 *  [wpetgb](https://wordpress.org/support/users/wpetgb/)
 * (@wpetgb)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/custom-menu-links-bug/)
 * Hi developer,
 * I am facing a bug in the latest 3 versions of your plugin.
 * I hope you understand my explanation.
 * I have a menu with some custom links. The **HREF** for all these menu item = **#**.
   Below those menu items i have sub items which are linked to real wordpress pages.
 * If i am visiting the website and standing on the home page (www.website.com/en)
   all the custom menu items get the class “current-menu-item”.
 * The problem only exists when visiting the home page, not the others.
 * I have looked up your code, and noticed this change causes the problems:
 *     ```
       function qtrans_parseURL($url) {
       	$result = parse_url($url);
       	if ($result === false)
       		return __legacy_qtrans_ParseURL($url);
   
       	$result = $result + array(
       			'scheme' => '',
       			'host' => '',
       			'user' => '',
       			'pass' => '',
       			'path' => '',
       			'query' => '',
       			'fragment' => ''
       	);
   
       	if (isset($result['port']))
       		$result['host'] .= ':'. $result['port'];
   
       	return $result;
       }
   
       function __legacy_qtrans_ParseURL($url) {
       	$r  = '!(?:(\w+)://)?(?:(\w+)\:(\w+)@)?([^/:]+)?';
       	$r .= '(?:\:(\d*))?([^#?]+)?(?:\?([^#]+))?(?:#(.+$))?!i';
   
       	preg_match ( $r, $url, $out );
       	$result = @array(
       			"scheme" => $out[1],
       			"host" => $out[4].(($out[5]=='')?'':':'.$out[5]),
       			"user" => $out[2],
       			"pass" => $out[3],
       			"path" => $out[6],
       			"query" => $out[7],
       			"fragment" => $out[8]
       	);
       	return $result;
       }
       ```
   
 * This is the structure of my menu:
 *     ```
       home
       custom menu item 1 with url = #
         - Sub item to real page 1
         - Sub item to real page 2
         - Sub item to real page 3
       custom menu item 2 with url = #
         - Sub item to real page 1
         - Sub item to real page 2
         - Sub item to real page 3
       custom menu item 3 with url = #
         - Sub item to real page 1
         - Sub item to real page 2
         - Sub item to real page 3
       ```
   
 * The problem stops after replacing this code with the old code from a previous
   version.
 * I hope you are able to fix this bug.
 * Kind regards,
 * wpetgb
 * [https://wordpress.org/plugins/mqtranslate/](https://wordpress.org/plugins/mqtranslate/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [masterbip](https://wordpress.org/support/users/masterbip/)
 * (@masterbip)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/custom-menu-links-bug/#post-5165017)
 * I got the same issue here. If I create a custom link to an anchor (#item) The
   plugin replace the output href link from
    `<a href="#item">` to `<a href="http://
   www.mysite.com/#item">`
 * Breaking my smooth scroll navigation…
 * Any help?
    Thanks in advance.
 *  [Tim Morley](https://wordpress.org/support/users/tim-morley/)
 * (@tim-morley)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/custom-menu-links-bug/#post-5165053)
 * I have the same bug, described here:
    [http://wordpress.org/support/topic/new-problem-menu-link-to-langde-no-longer-works?replies=1](http://wordpress.org/support/topic/new-problem-menu-link-to-langde-no-longer-works?replies=1)
 * I use custom menus to switch languages (linking to `lang=en` etc.) but now they’re
   broken. 🙁
 *  [masterbip](https://wordpress.org/support/users/masterbip/)
 * (@masterbip)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/custom-menu-links-bug/#post-5165054)
 * I figured out that this is caused with the MQTRANSLATE plugin. Y changed back
   to qTranslate and the problem is solved. It is not a wordpress issue but that
   plugin problem.
 * Thanks!
 *  [MarionWante](https://wordpress.org/support/users/marionwante/)
 * (@marionwante)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/custom-menu-links-bug/#post-5165096)
 * There is a bug somewhere in mqtranslate_utils.php.
    With every update I replace
   this particular file with a previous one from an older version and ever since
   no problems with custom links anymore. Hope this helps someone.
 *  [masterbip](https://wordpress.org/support/users/masterbip/)
 * (@masterbip)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/custom-menu-links-bug/#post-5165098)
 * For sure it is a plugin “bug” … Can the plugin creator solve this “issue”
 * Thanks!!!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Custom menu links bug’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/mqtranslate_b2b2b2.svg)
 * [mqTranslate](https://wordpress.org/plugins/mqtranslate/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mqtranslate/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mqtranslate/)
 * [Active Topics](https://wordpress.org/support/plugin/mqtranslate/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mqtranslate/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mqtranslate/reviews/)

## Tags

 * [active](https://wordpress.org/support/topic-tag/active/)
 * [class](https://wordpress.org/support/topic-tag/class/)

 * 5 replies
 * 4 participants
 * Last reply from: [masterbip](https://wordpress.org/support/users/masterbip/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/custom-menu-links-bug/#post-5165098)
 * Status: not resolved