• Juan

    (@juanmiqueo)


    We have the same setup for all our customers, use a folder for language, default language hidden in URL and default home page for language use only language code.

    We are experiencing some problems :

    1/ On menus translated pages permalinks are not including the language prefix
    2/ In some cases a loop of redirect on the language page
    3/ Its seems the following snippet is not taking into account the language preffix
    if ( function_exists(‘icl_object_id’) ) {
    $page = get_page_by_path( $page_id );
    $pageId = $page ? $page->ID : null;
    if ($pageId != null) {
    $translated_id = icl_object_id( $pageId, ‘page’ );
    if ( $translated_id ) {
    $page = get_page($translated_id);
    if ( $page ) {
    return get_permalink( $page->ID ); // $page->post_name
    }
    }
    }
    }

    We thing this is happening since our last update

    Our setup is:

    – Multi site wordpress
    – Wp-Ultimo and sunrise to manage custom domains
    – Polylang form language

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Juan

    (@juanmiqueo)

    Hi!

    I could find the problem and solve it locally. How can I notify it so it can be solved and deployed

    In file links-directory.php line 72 on function add_language_to_link

    $root = ( false === strpos( $url, ‘://’ ) ) ? $this->home_relative . $this->root : preg_replace( ‘#^https?://#’, ‘://’, $this->home . ‘/’ . $this->root );

    The last part, $this->home . ‘/’ . $this->root is adding an extra slash at the end and then the process does not replace the URL including the code

    We have solved using the following patch but I’m secure you can solve it a better way. Added after line 72

    if (preg_match( ‘/\/\/$/’, $root)) {
    $root = substr( $root, 0, -1 );
    }

    Thanks

    Hi there! Struggling exactly the same here…

    Tried to put your code at the line 73, but is doesn’t work:
    if (preg_match( ‘/\/\/$/’, $root)) {
    $root = substr( $root, 0, -1 );
    }

    All my best!

    Same bug here.

    Thread Starter Juan

    (@juanmiqueo)

    Hi @redpik,

    Did you try what we did?

    We make a pull request on the plugin github repository

    https://github.com/polylang/polylang/pull/973

    @juanmiqueo have you received any answer? And have you fixed your problem?

    I have the same problem, and even I tried your code, it not works…

    I imagine since the last plugin update some bug has appeared.

    I’m struggling that problem of the hidden flags as well as the fact of the slugs are not including the language folder…

    Finally found the problem, and in my case it was not related to “Polylang”, otherwise to “Polylang Connect for Elementor”.

    I have used the “WP Rollback” plugin to get back the 1.0.6 version of the “Polylang Connect for Elementor” and everything worked fine.

    Of course in the perfect scenario the plugin creators should provide a better solution. But by now, there is a solution.

    Thread Starter Juan

    (@juanmiqueo)

    Hi @guinery,

    Thank you. I will check it to check if it solves our problem. It’s complicated when there are come plugins in our Stack to find the what is failing.

    Did it affect to Polylang menu?

    Regards

    @juanmiqueo I don’t know, but in our case, it worked! ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘slugs does not include language folder’ is closed to new replies.