Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 13:00 9:00 – 13:00 9:00 – 13:00 8:00 – 12:00 8:00 – 12:00 -
- 14:00 – 17:00 14:00 – 18:00 14:00 – 18:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Europe/Zagreb (GMT+02:00)

Tagged: 

This topic contains 27 replies, has 2 voices.

Last updated by Bruno Kos 11 months, 3 weeks ago.

Assisted by: Bruno Kos.

Author Posts
December 28, 2023 at 9:47 am #15134007

Ralph Klerk

Our Woocommerce shop page randomly stops working and is showing the blank page contents of the WordPress page which is assigned as shop page in the Woocommerce settings.

Link to page where the issue can be seen: hidden link

We expect to see: The Woocommerce Shop page containing the product-archive.

Instead, we sometimes get: The blank WordPress page which is assigned as shop page in the Woocommerce settings.

We've done some debugging and digging ourselves and when this happens, the rewrite_rules option in the database are localized. Normally it should look something like this (unserialized):

array (
...
  'luxury-real-estates/?$' => 'index.php?post_type=product',
  'luxury-real-estates/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=product&feed=$matches[1]',
  'luxury-real-estates/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=product&feed=$matches[1]',
  'luxury-real-estates/page/([0-9]{1,})/?$' => 'index.php?post_type=product&paged=$matches[1]',
 ...
 );

However, when the Woocommerce Shop (archive) wasn't working just now, the rewrite_rules option in the database looked like this (localized to German slug):

array (
...
  'luxusimmobilien/?$' => 'index.php?post_type=product',
  'luxusimmobilien/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=product&feed=$matches[1]',
  'luxusimmobilien/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=product&feed=$matches[1]',
  'luxusimmobilien/page/([0-9]{1,})/?$' => 'index.php?post_type=product&paged=$matches[1]',
 ...
 );

- We've also seen the other localized slugs in the rewrite_rules option
- No PHP errors are logged when this happens
- Saving the permalink-settings in WordPress normally is enough to get all things working again
- After a few days of testing, we've not been able to reproduce/trigger this ourselves

Fyi: we are running behind Cloudflare.

December 28, 2023 at 1:41 pm #15134970

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support!

Can you apply this workaround and observe within the course of few days if the issue is still there?
https://wpml.org/errata/htaccess-is-rewritten-with-language-folder/

Regards,
Bruno Kos

December 28, 2023 at 1:56 pm #15135010

Ralph Klerk

Hi Bruno,

We'll try the snippet and let you know if this solves the problem. Thanks for now!

December 28, 2023 at 2:30 pm #15135061

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Sure, keep us posted!

January 3, 2024 at 8:41 am #15145480

Ralph Klerk

Unfortunately that snippet doesn't solve the problem. Over the last 24 hours we've seen the rewrite rules going localized at least 2 times 🙁

January 3, 2024 at 11:55 am #15146299

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

I see - I asked our 2nd tier about this, I will keep you posted.

January 4, 2024 at 6:56 am #15149256

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Can you provide me a site Duplicator package, but created only when the site is broken so when htaccess is rewritten and shop page not working?

https://wpml.org/faq/provide-supporters-copy-site/

Please exclude all the media files, etc, to keep the package minimal.

January 9, 2024 at 2:15 pm #15165026

Ralph Klerk

Hi, just a quick update: this weekend the rewrite rules went localized twice, but we didn't have the opportunity to make a snapshot. We will provide it asap!

January 9, 2024 at 2:21 pm #15165083

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Ok, sounds like a plan.

January 10, 2024 at 9:36 am #15167793

Ralph Klerk

Yes, we've managed to make a snapshot of the broken site. Where can post a private reply with the details?

January 10, 2024 at 10:18 am #15168000

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Reply set as private.

January 10, 2024 at 11:18 am #15168213

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

I escalated the case to our 2nd tier, let's see if they can get to some ideas here given that we don't know why and how this happens.

January 12, 2024 at 7:43 am #15177416

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

We are unable to reproduce this or find a cause, can you try this?

1. Edit wp-config.php and insert the following lines (just before /* That's all, stop editing! Happy publishing. */ part)

define( 'WP_DEBUG', true);
define( 'WP_DEBUG_LOG', true);
define( 'WP_DEBUG_DISPLAY', false);

And then add this to theme functions.php:

function check_rewrite_rules_update( $option_name, $old_value, $value ) {
    if ( 'rewrite_rules' === $option_name ) {
        error_log( 'rewrite_rules option updated' );
        error_log( print_r( debug_backtrace(), true ) );
    }
}

add_action( 'updated_option', 'check_rewrite_rules_update', 10, 3 );

This should log to the debug log and it will print the stack trace of the process that is updating the option.

Do note that this will hook onto ALL update options and it might cause performance issues and it is not recommended for continuous use.

So alternatively you can use:

function check_rewrite_rules_update( $old_value, $value ) {
        error_log( 'rewrite_rules option updated' );
        error_log( print_r( debug_backtrace(), true ) );
}

add_action( 'update_option_rewrite_rules', 'check_rewrite_rules_update', 10, 2 );
January 12, 2024 at 9:51 am #15178074

Ralph Klerk

Thanks, we've added the debugging rules. So far we didn't manage to trigger the update ourselves too, so let's wait and see...

January 15, 2024 at 6:33 am #15183047

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Ok, keeps us posted.

The topic ‘[Closed] Woocommerce shop page not working, rewrite_rules in database localized’ is closed to new replies.