This thread is resolved. Here is a description of the problem and solution.
Problem:
HTTP Headers plugin - Call to a member function switch_to_locale() when String Translation is active
https://wordpress.org/plugins/http-headers/
Solution:
1. Take a backup of your site in case something goes wrong.
2. Edit with code editor the following file in the HTTP Headers plugin folder.
/wp-content/plugins/http-headers/http-headers.php
3. Replace the following lines 1417/1418
add_action("added_option", 'http_headers_option'); add_action("updated_option", 'http_headers_option');
with:
add_action("added_option", function() { add_action('admin_init', 'http_headers_option'); add_action("updated_option", 'http_headers_option');});
4. This should solve the fatal error issue when saving the HTTP Headers options.
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.
Our next available supporter will start replying to tickets in about 6.89 hours from now. Thank you for your understanding.
This topic contains 10 replies, has 2 voices.
Last updated by alexD-36 4 years, 6 months ago.
Assisted by: Itamar.
Author | Posts |
---|---|
April 13, 2020 at 7:24 am #5894573 | |
alexD-36 |
I installed WPML on a working WP site. It might have an incompatibility with the HTTP Headers plugin https://wordpress.org/plugins/http-headers/.As soon as I change the headers config, I get this message in the browser. |
April 13, 2020 at 9:20 am #5895287 | |
Itamar Supporter
Languages: English (English ) Hebrew (עברית ) Timezone: Asia/Jerusalem (GMT+02:00) |
Hi. We need to replicate this issue on a fresh WordPress installation. Then I'll be able to escalate it to our compatibility team. For this, I created a test website with a clean WordPress install. You can access it through this link: -site removed-- With this link, you'll be directly logged in. Could you please install the https://wordpress.org/plugins/http-headers/ plugin and see if the issue is replicable on a clean WordPress installation? When everything is finished, and you can replicate the problem, please let me know. Thanks, |
April 15, 2020 at 12:33 am #5908589 | |
alexD-36 |
Hi, Then, I desactivated WPML String Translation plugin, and I was able to add the header without problem. Alex |
April 15, 2020 at 7:51 pm #5916761 | |
Itamar Supporter
Languages: English (English ) Hebrew (עברית ) Timezone: Asia/Jerusalem (GMT+02:00) |
Hi, Alex and thanks for installing the plugin on the test site. I'm sorry but I'm not familiar with this plugin and how to configure it. Thanks, |
April 15, 2020 at 11:02 pm #5917495 | |
alexD-36 |
Hi, Notice that this problem is more serious than it looks. Initialy, I installed WPML on the site with WooCommerce, Elementor and HTTP Headers plugins. After the upload of the plugin, it took some time, I got a 503 error. The web site was down, killed. We lost hours trying to figure out what happened. We are in a kubernetes environement. The container would no longer start, even after re-initialization. In fact, some files stayed on attached volumes. Not that easy to edit when the container would not even start... |
April 18, 2020 at 7:25 am #5937627 | |
Itamar Supporter
Languages: English (English ) Hebrew (עברית ) Timezone: Asia/Jerusalem (GMT+02:00) |
Hi and thanks for the extra details. I've escalated this issue to our compatibility team and they will debug it and try to find a fix for it. If we would not be able to fix this issue only from our side, we might need the cooperation of the author of the plugins. It would be great if you could contact the authors and urge them to join our Go Global Program. You can find details about it here. In any case, I'll keep you updated here when I have news from our compatibility team regarding this issue. Thank you for your patience. |
April 18, 2020 at 12:52 pm #5939135 | |
alexD-36 |
Hi, |
April 20, 2020 at 12:09 pm #5949049 | |
Itamar Supporter
Languages: English (English ) Hebrew (עברית ) Timezone: Asia/Jerusalem (GMT+02:00) |
Hi, Our compatibility team has found a fix for this issue. Here is what you need to do. 1. Take a backup of your site in case something goes wrong. 2. Edit with code editor the following file in the HTTP Headers plugin folder. 3. Replace the following lines 1417/1418 add_action("added_option", 'http_headers_option'); add_action("updated_option", 'http_headers_option'); with: add_action("added_option", function() { add_action('admin_init', 'http_headers_option'); add_action("updated_option", 'http_headers_option');}); 4. This should solve the fatal error issue when saving the HTTP Headers options. It work for me on the test site. Can you please check if it works for you as well? Regards, |
May 4, 2020 at 11:10 pm #6056547 | |
alexD-36 |
Itama, would it be possible to give access to an evaluation version of WPML to HTTP Headers author? |
April 24, 2021 at 5:15 pm #8615115 | |
alexD-36 |
Hello, Alex |