Skip to content Skip to sidebar

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 10 replies, has 2 voices.

Last updated by Waqas Bin Hasan 11 months, 3 weeks ago.

Assisted by: Waqas Bin Hasan.

Author Posts
August 27, 2024 at 8:56 am #16108400

teamD-4

Background of the issue:
I am trying to duplicate a page for a different language (US => int). The original page is hidden link and I want the duplicated page to be available at hidden link.

Weirdly enough while there is no post available I can fetch ACF fields ( get_field('hero_subtitle') )

Symptoms:
The duplicated page is returning a 404 error.

Questions:
Why is the duplicated page returning a 404 error?
How can I successfully duplicate a page for a different language without encountering a 404 error?

August 27, 2024 at 12:00 pm #16109439

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting the support.

May I ask for the debug information of your website for an overview of your setup? See https://wpml.org/faq/provide-debug-information-faster-support/ for more information.

I've enabled the debug information section for your next reply.

Additionally you can also take a look at https://wpml.org/faq/checklist-before-opening-a-ticket-in-wpml-support/ and cross-check for a few initial fixes.

See https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/ for details on privacy and security.

Regards.

August 28, 2024 at 12:36 pm #16114977

teamD-4

I've already tried changing the PermalinkStructure to the suggested structure ( /%year%/%monthnum%/%postname%/ ) and that does not seem to solve it.

August 29, 2024 at 5:17 am #16117466

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the debug information.

I see that you're using older versions of WordPress and WPML plugins. Please fix and try the following:

IMPORTANT: Please take full backup of your website and database beforehand.

It is highly advised to try this on a staging/dev site first, so your live website isn't compromised.

1) Update WordPress, WPML, ACF and other plugins and theme to the latest version.
2) Deactivate all plugins except WPML and String Translation.
3) Switch to a standard WordPress theme like 2024.
4) Clear all caches and recheck.

Please let me know your findings, and, I'll try my best to help you further on the matter.

August 29, 2024 at 2:30 pm #16120651

teamD-4

I've deactivated all other plugins, switched to 2024 theme, updated WordPress and all plugins, cleared cache (WordPress and WPML) but sadly didn't make any difference

August 30, 2024 at 7:10 am #16123072

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the updates.

I need to take a closer look at your site. So I request temporary access (WP-Admin and FTP), preferably to a test site where the problem has been replicated.

Your next answer will be private, to share this information safely.

Also provide detailed steps to reproduce the issue and links to pages in the admin and on the frontend.

IMPORTANT: Please take a complete backup of the site to avoid data loss. I may need to activate/deactivate plugins also.

See https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/ for details on privacy and security.

August 30, 2024 at 3:12 pm #16125589

teamD-4

Thank you for your time. I've managed to find the problem, the issue has to do with caching. When calling the get_single_slug_adjusted_IDs function it returns an cached array of page ID's with the same page name. This cache is set when viewing a created page. When you duplicate this page and view that page, it still returns the old cached array and does not contain the new page ID.

Is this a bug or should the cache be cleared when duplicating a page? Do you know what could be the issue here

September 2, 2024 at 8:31 am #16130527

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the updates.

Yes cache can be a problem and it depends which cache you're using (i.e. a plugin or on server side) and how it is rebuilding the stuff based on changes in your site.

Usually caches behave like this but you can configure it to rebuild based on content changes or on intervals (i.e. lower intervals if you update content frequently).

September 5, 2024 at 9:39 am #16143989

teamD-4

Where in the code of WPML would the cache of WPML_Page_Name_Query_Filter be cleared after updates of content? I cannot find it, could it be a bug in WPML?

September 5, 2024 at 10:07 am #16144154

teamD-4

I face the problem without any caching plugins or solutions enabled.
The following code fixes the problem for me:

add_action('save_post', 'clear_wpml_cache_on_save_post', 10, 0);
function clear_wpml_cache_on_save_post(): void
{
$cache = new WPML_WP_Cache(WPML_Page_Name_Query_Filter::class );
$cache->flush_group_cache();
}

But of course this shouldn't need to be added in the project

September 5, 2024 at 1:07 pm #16145181

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

I need to take a closer look at your site. So I request temporary access (WP-Admin and FTP), preferably to a test site where the problem has been replicated.

Your next answer will be private, to share this information safely.

Also provide detailed steps to reproduce the issue and links to pages in the admin and on the frontend.

IMPORTANT: Please take a complete backup of the site to avoid data loss. I may need to activate/deactivate plugins also.

See https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/ for details on privacy and security.

September 5, 2024 at 2:13 pm #16145615

teamD-4

Thanks, but that's not needed, our company is careful about sharing any data of our clients with external parties (also for ISO). The problem is fixed for us now, so this ticket can be closed.