availability:

WPML Version: 3.2.1

description:
  • To make sure a WPML dependent code is executed at the right time, this code should be hooked into the wpml_loaded action. This action is called after WPML is fully configured and loaded.
  • If we do not hook into this wpml_loaded, sometimes the WPML dependent code might be called too early. Then even if WPML is active and configured, we may not get expected results.
  • wpml_loaded is executed during the plugins_loaded action.
  • There are similar hooks for WPML String Translation wpml_st_loaded and WPML Translation Management wpml_tm_loaded. They are both hooked to wpml_loaded.
type:
action
category:
Miscellaneous
parameters:
add_action( 'wpml_loaded', callable $function_to_add );
$function_to_add
(callable) (Required) Your callback to be run when the filter is applied.
hook example usage:

Example

function my_plugin_wpml_code() {
  // Run WPML dependent actions
  // These actions will be executed right after WPML is fully configured and loaded.
}

add_action( 'wpml_loaded', 'my_plugin_wpml_code' );