Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress domain change notice on multilingual sites #7222

Open
camilamadronero opened this issue Jan 10, 2025 · 0 comments
Open

Suppress domain change notice on multilingual sites #7222

camilamadronero opened this issue Jan 10, 2025 · 0 comments
Labels
priority: low Issues that can wait

Comments

@camilamadronero
Copy link

camilamadronero commented Jan 10, 2025

Describe the bug
On a multi-domain installation using WPML, where different languages are mapped to different domains, whenever one of the translated domain's WP Admin is accessed, this causes the domain change notice to display: https://docs.wp-rocket.me/article/705-changing-domains-migrating-sites-with-wp-rocket#deactivate-reactivate.

  • If the notice is ignored, nothing will break, WP Rocket will continue to work normally.

  • But if the notice is clicked to regenerate the config files, WP Rocket will only regenerate the config file for the domain you clicked the button from. WP Rocket will only work on that specific domain, and not on the other mapped domains. If you deactivate/re-activate WP Rocket, all the config files will be generated.

To Reproduce
Steps to reproduce the behavior:

  1. Set up a single WordPress install with WPML and different mapped domains. Example: https://i.imgur.com/PVTG8cA.png.
  2. Install WP Rocket.
  3. Enter the /wp-admin/ from the different domains, until you see the admin notice.
  4. Click on the regenerate files button, and see the issue.

Expected behavior
As per Alfonso: we are initially creating the config files correctly, so we should prevent the transient rocket_domain_changed to be triggered if you log in from a different domain that’s defined inside the WPML config

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

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Ticket: https://secure.helpscout.net/conversation/2813670834/533998?viewId=2675957
Slack: https://wp-media.slack.com/archives/C43T1AYMQ/p1736355324192949

Temporal solution:
To hide the admin notice with this snippet:

add_action( 'rocket_detected_domain_changed', 'wpr_prevent_domain_changed_message', PHP_INT_MAX );

function wpr_prevent_domain_changed_message() {

  if ( function_exists( 'delete_transient' ) ) {
    delete_transient( 'rocket_domain_changed' );
  }
};
@piotrbak piotrbak added the priority: low Issues that can wait label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low Issues that can wait
Projects
None yet
Development

No branches or pull requests

2 participants