Support » Plugins and Hacks » Qtranslate Slug » [Resolved] A small bug with big influence

[Resolved] A small bug with big influence

  • Do yourself a favor and replace the existing function with that one:

    public function _get_page_link( $link, $id ) {
    		global $post, $wp_rewrite, $q_config;
    		$post2 = $post;
    		if ( !$id )
    			$id = (int) $post->ID;
    			$post2 = &get_post($id);
    		$draft_or_pending = in_array( $post2->post_status, array( 'draft', 'pending', 'auto-draft' ) );
    		$link = $wp_rewrite->get_page_permastruct();
    		if ( !empty($link) && ( isset($post2->post_status) && !$draft_or_pending ) ) {
    			$link = str_replace('%pagename%', $this->get_page_uri($id), $link);
    			$link = trim($link, '/'); // hack
    			$link = home_url("/$link/"); // hack
    			if ($q_config['url_mode'] != 1)
    				$link = user_trailingslashit($link, 'page');
    		} else {
    			$link = home_url("?page_id=$id");
    		return $link;

    Your plugin is then not chaning the $post and a lot of other plugins are working with yours. I only changed the $post to $post2 and many stuff like breadcrumbs, diffrent themes and seo plugins are working again without any problem and also the_title() is returning well what it should and so one ๐Ÿ˜‰


Viewing 4 replies - 1 through 4 (of 4 total)
  • Stefan, you made my day. Your code fixes a problem that mad me search for 4 days…

    We noticed a strange behaviour in a blog and could absolutely not explain what was happening behind the scenes. I just noticed that โ€“obviouslyโ€“ IDs were mixed up heavily by wordpress.

    To be sure, we added code that would show me the ID not only in the URL but also
    – in the <TITLE>
    – in my page’s content (next to the article date, which did not match for the shown headline/text)
    – in a sidebar widget

    In these 4 places, I found 4 different IDs :-/
    I assumed that the fault was in qTranslate itself, but after testing more intensive I could spot “qTranslate-slug” was causing the error.

    And with your code, everything works fine again. Thanks a lot!

    Carlos, you really should update your function ๐Ÿ™‚

    Plugin Author Carlos


    I take note, thanks!

    You are my hero! Thank you so much! It made my day ๐Ÿ™‚

    And please, developers of this plugin, prepare 1.2 version with this bug officially fixed.

    Plugin Author Carlos


    Fixed (https://github.com/not-only-code/qtranslate-slug/issues/31).

    I close this topic.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] A small bug with big influence’ is closed to new replies.
Skip to toolbar