• Hello,

    since the last update, I have been experiencing an issue with permalinks due to the Polylang plugin. Let me describe the behavior. I have a website blog.jirivanek.eu, where the primary language is Czech, and the secondary language is English. The website contains many articles and pages with translations. Now, it frequently happens that WordPress loses permalinks for pages in the primary language, but only for pages, not articles. The situation is as follows:

    • Articles in the primary language (Czech) work fine.
    • Articles in the secondary language (English) work fine.
    • Pages in the primary language (Czech) do not work (result in a 404 error).
    • Pages in the secondary language (English) work fine.

    As you can see, the permalinks are only lost for pages in the primary language. Clicking on a link to a page in the primary language leads to a 404 error. The issue can be temporarily resolved by regenerating the permalinks (Settings -> Permalinks -> Choose a different permalink structure -> Save changes -> Revert to the original structure -> Save changes). After doing this, everything works fine for a while.

    I am using the latest versions of WordPress (6.2.2) and Polylang. The server is running PHP 8.2 and Apache. Apart from updating Polylang, there have been no changes to the server configuration, including server or package updates. The server is running on PHP 8.2 FPM (MPM prefork, but the same behavior occurs with MPM event). The Apache log shows the following warning:

    Warning: Attempt to read property “slug” on bool in /wp-content/plugins/polylang/include/crud-terms.php on line 197

    This error is generated in the Apache log for every page that is not working at that moment. I am using the current version of Generate Press (free version) as my theme, along with the Elementor page builder and Elementor PRO.

    I am unsure if this is a plugin issue or how to proceed further. It is quite problematic to discover that pages in the primary language are not working for several hours or days, and it severely impacts SEO. Currently, I am using a snippet that automatically regenerates the permalinks using flush_rewrite_rules(); if it detects a 404 error for a page. However, even with this solution, I cannot avoid the initial 404 error until the snippet takes action.

    Thank you and best regards.

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chouby

    (@chouby)

    Hello,

    As you already analzed, something is messing your rewrite rules.
    I suggest that you make tests on a clone site.
    1. Detect if possible which action(s) messes your rewrite rules.
    2. Check if it happens once you have deactivated all plugins (except Polylang) and switched to a default theme (Twenty something).
    3. If this happens with only Polylang active, it would be great that you try to reproduce the issue starting from a fresh install and then open a GitHub issue with all necessary steps to reproduce. This would help us to fix the bug.
    4. If you don’t reproduce when only Polylang is active, then you’ll need to activate your theme and plugins one by one until you reproduce. Once you find it, report the issue to the author. This may due to a wrong usage of flush_rewrite_rules() .

    Thread Starter jirivanek626

    (@jirivanek626)

    Hello,

    I performed several simulations and searched for the issue for quite a while. In the end, I found it. I’m not sure whether Polylang or Elementor caused the problem, but the core issue was the deactivated Heartbeat function in WordPress. At least Elementor uses this API; I’m not sure about Polylang. So, if anyone encounters a similar problem, it might be caused by disabling the Heartbeat in the administration interface.

    Thank you for your assistance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘The issue with permalinks on pages in the primary language’ is closed to new replies.