Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter firetix

    (@firetix)

    Hi, Sami .

    Thank you for your reply.
    I managed to get it working by modifying the
    permalinks_customizer_post_link() function as follows:

    The thing is that Polylang is adding the language prefix to the url. this is why we get the language code two times.

    function permalinks_customizer_post_link($permalink, $post) {
       $permalinks_customizer = get_post_meta( $post->ID, 'permalink_customizer', true );
       if ( $permalinks_customizer ) {
           $str = "/".$permalinks_customizer;
    
          return home_url($str,'relative'); // This builds a url relative to "languagecode/my-custom-link" and allow polylang to add the language prefix correctly
       }
    
       return $permalink;
    }

    I no longer get the 404.

    Another issue that i’m getting is:
    When i call get_permalink() in my templates or custom plugins. The link that is display is the default one, not my customised one.

    Any idea on that part ?

    When you have some free time, it would be nice to have some comments in your plugin code so that its more readable 🙂

    Thanks again.

    firetix

    (@firetix)

    Hi Xanderkrosh.
    Have you resolved your problem ?

    I’m getting the same problem

    firetix

    (@firetix)

    I have the same issue.

    Links when viewed on front page are generated as:

    http://www.mysite/en/en/page-slug

    if we remove the double en, the link works find else we get a 404 error.

    I have the same error if i define a custom permalink in code.

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