Skip to content

rocket_clean_files() incorrectly triggers a full cache purge when the URL contains query strings #6130

@sandyfzu

Description

@sandyfzu

Before submitting an issue please check that you’ve completed the following steps:

  • Made sure you’re on the latest version ✅
  • Used the search feature to ensure that the bug hasn’t been reported before ✅

Describe the bug
When a draft post is saved / updated, URLs like the ones below are sent to rocket_clean_files:

/es/?p=245/
/en/?p=245/

Here:

rocket_clean_files( $clear_urls );

This causes the cache in /es/ and /en/ to be fully cleared

Something similar happens when a WooCommerce order is created or updated. URLs like the ones below are sent to rocket_clean_files:

/es/?post_type=shop_order&p=251/
/en/?post_type=shop_order&p=251/

And the cache is cleared on those folders too.

To Reproduce
Steps to reproduce the behavior:

  1. Make sure TranslatePress is installed and activated
  2. Log $clear_urls variable here:
  3. Update a draft post or a WooCommerce order.
  4. See the URLs in the log file
  5. See the languages' folders in the cache folder

Expected behavior
The full cache of languages shouldn't be cleared

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Acceptance Criteria (for WP Media team use only)
Clear instructions for developers, to be added before the grooming

Metadata

Metadata

Assignees

No one assigned

    Labels

    3rd party compatibilityIssues related to 3rd party compatibility like theme, plugin or hostingneeds: product cleanuppriority: mediumIssues which are important, but no one will go out of business.severity: moderateFeature isn't working as expected but has work around to get same valuetype: bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions