load_plugin_textdomain in `plugins_loaded` or `init`?

Load translation files as late as possible for your plugin’s use-case. This allows other plugins as much time as possible to fully initialise.

Why should you care about other plugins? Because they may be involved in the localisation process too. For example, changing the site language or filtering translation file paths. They can’t do those things if you beat them to it.

From your two examples: plugins_loaded fires first, so init is the better of the two in most cases. However, it still runs the risk that your init code fires before another plugin’s init code, so set a low priority in your add_action call. (larger number = lower priority).

If your translations are needed earlier then you’ll have to load them earlier. However, if you need them earlier than init then your whole setup might be firing too early.

Leave a Comment