@leemon, I marked it as resolved because it makes sense we are updating the hooks in our code.
Initially I did switch to using after_setup_theme hook, and it did not work, the translations were not picked up. After playing with the hook priority (do not leave it to the default priority), I got it to work as intended and also the notices are gone. So, this was a false positive issue, using the hook suggested in the notices makes things work as intended, but only when we do some higher priority.
-
This reply was modified 1 year, 1 month ago by
Iulia Cazan.
@iulia-cazan Are you saying it works with after_setup_theme with a different priority? What did you change the priority to?
I’ve tried it with 10 (default), 11, 1, and even PHP_INT_MAX and 0 - PHP_INT_MAX to test the extremes, and I can’t make the notice go away. (Interestingly, get the notices twice for my plugins. Using this hook makes one go away, but another persists. I can’t figure out why, but this is happening in a Multisite setup with Network Active plugins, so perhaps that’s the issue.)
Scratch my previous reply.
Tip for fellow plugin developers who are running into this issue:
- You probably don’t need to call
load_plugin_textdomain() at all because WordPress has a just-in-time loader for translations in all versions after 4.6. I deleted the code from my plugins and the translations are still working without it, but I still got the warning, because…
- I poked around a bit further and determined that the call that is generating the notice is at line 151 in
wp-admin/includes/plugin.php in the _get_plugin_data_markup_translate() function. That private function is called by the public function get_plugin_data() which I do use in my plugins, fairly early. I see that function has a parameter to bypass translation, so that seems to be my fix.
So, if you’re still getting the error after removing the direct call in your plugin, check if you’re using the get_plugin_data() function, and be sure to set its third input parameter ($translate) to false.
-
This reply was modified 1 year, 1 month ago by
room34.
Hi @leemon,
I’m pleased to inform you that we have released version 14.10.3 of WP Statistics, which resolves the incompatibility issue with WordPress version 6.7.
Please update the plugin to the latest version and enjoy!
Regards
@macmanx, I reopened the issue as it seems this is still replicable in 6.7 and now maybe it seems more relevant https://github.com/woocommerce/woocommerce/issues/52646
Additionally, for some plugins the text domain do not get picked up anymore, regardless of the hook used.
Does anyone know where is the new/updated documentation regarding the plugins translations – if available – after the new changes introduced in 6.7?