• Resolved floadrmd

    (@floadrmd)


    Hi,

    I attempted to set up a custom permalink on my page, but it consistently returns a 404 error. The website is installed in a subdirectory (/en-us/). Interestingly, the page functions correctly when the plugin is deactivated.

    Any assistance you can provide would be greatly appreciated.

    Thank you!

    Best regards,

    —————————————————————————————
    DEBUG DATA SECTION
    Array
    (
    [3151] => products/myproductpage
    )

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

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

    (@floadrmd)

    With debug_url=1

    Array
    (
    [uri_parts] => Array
    (
    [lang] =>
    [uri] => en-us/products/myproductpage
    [endpoint] =>
    [endpoint_value] =>
    )

    [old_query_vars] => Array
        (
            [attachment] => myproductpage
        )
    
    [new_query_vars] => Array
        (
            [attachment] => myproductpage
        )
    
    [pm_query] => -
    [content_type] => -
    [version] => 2.4.3.4

    )


    informations on pm_query and content_type are empty

    Plugin Author Maciej Bis

    (@mbis)

    Hi @floadrmd,

    Please accept my apology for late response and inconvenience. According to the debug data, it seems like the language code is not properly parsed from the request URL. As of now, Permalink Manager is compatible only with WPML & Polylang plugins and no other language plugin is officially supported.

    Could you try to manually overwrite the extracted URI parts using below code snippet?

    function pm_remove_language_code( $uri_pats ) {
    // Check if 'en-us' exists in the URI
    if ( strpos( $uri_pats['uri'], 'en-us' ) !== false ) {
    // Replace 'en-us' with an empty string
    $uri_pats['uri'] = str_replace( 'en-us/', '', $uri_pats['uri'] );
    }

    return $uri_pats;
    }
    add_filter('permalink_manager_detect_uri', 'pm_remove_language_code');

    Best regards,
    Maciej

    Thread Starter floadrmd

    (@floadrmd)

    Hi Maciej,

    Thank you very much for your reply and support.

    The override works perfectly now. I don’t use any translation plugins; the en-us code is simply a subdirectory containing the WP installation.

    Best regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.