• Hi,

    I use a custom permalink structure:
    /%postname%
    without a trailing slash. But I get a problem on several pages using the “?lang=en” method for generating the translation links.

    It would be nice if you could check if the function
    get_option('permalink_structure')
    returns a string with a trailing slash or not and append only a slash to the URL if neccessary.

    Currently I have changed the file
    frontend\utils.php
    so I can use the plugin.

    Best regards
    Nils

    https://wordpress.org/plugins/ceceppa-multilingua/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,
    thanks for suggestion.. . Can you post your edit so I can apply the patch?

    Thread Starter derniwi

    (@derniwi)

    Hi,

    I modified the function “cml_get_the_link()” in the file “frontend\utils.php”. Just replace “return $link;” with this code:

    // Get the last character from the permalink structure definition
      $permalink_structure = get_option('permalink_structure');
      if ( $permalink_structure !== '' ) {
        if ( substr( $permalink_structure, -1 ) != '/' ) {
          $link = untrailingslashit( $link );
        }
      }
    
      return $link;

    Hope this is ok. 😉

    Regards
    Nils

    Thanks 🙂

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

The topic ‘check 'permalink_structure' for trailing slashes’ is closed to new replies.