I have an old abandoned plugin that I still use and so I cant have the developer to update it. I am receiving 1000s of PHP notices a day in my debug log with the _load_textdomain_just_in_time error.
This is the notice:
PHP Notice: Function _load_textdomain_just_in_time was called
incorrectly. Translation loading for the visitor-maps domain was
triggered too early. This is usually an indicator for some code in the
plugin or theme running too early. Translations should be loaded at
the init action or later. Please see Debugging in WordPress for more
information. (This message was added in version 6.7.0.)
In my attempts to try and correct the code – I have researched fixes where it shows the ‘wrong’ code and then the ‘correct code’ but the examples I have seen – none are worded the exact same as what I have, and so I am unsure and hesitant – for example see this link: Notice: Function _load_textdomain_just_in_time was called incorrectly
I believe I have found the code lines in the plugin that is causing the error in my abandoned plugin:
----
function visitor_maps_init() {
if (function_exists('load_plugin_textdomain')) {
load_plugin_textdomain('visitor-maps', false, 'visitor-maps/languages' );
}
----
Could anyone advise how I could adjust the above code so that it resolves the php notice?