Skip to content

Commit c364c1b

Browse files
committed
Fix load_plugin_textdomain() called too early
1 parent 766dc45 commit c364c1b

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

duracelltomi-google-tag-manager-for-wordpress.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,32 @@
3535
require_once GTM4WP_PATH . '/common/readoptions.php';
3636

3737
/**
38-
* WordPress hook function run after plugins have been loaded.
38+
* WordPress hook function to load translations
3939
*
40-
* @see https://developer.wordpress.org/reference/hooks/plugins_loaded/
40+
* @see https://developer.wordpress.org/reference/hooks/init/
4141
*
4242
* @return void
4343
*/
4444
function gtm4wp_init() {
4545
load_plugin_textdomain( 'duracelltomi-google-tag-manager', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
46+
}
47+
add_action( 'init', 'gtm4wp_init' );
48+
49+
/**
50+
* WordPress hook function run after plugins have been loaded.
51+
*
52+
* @see https://developer.wordpress.org/reference/hooks/plugins_loaded/
53+
*
54+
* @return void
55+
*/
56+
function gtm4wp_plugins_loaded() {
4657
if ( is_admin() ) {
4758
require_once GTM4WP_PATH . '/admin/admin.php';
4859
} else {
4960
require_once GTM4WP_PATH . '/public/frontend.php';
5061
}
5162
}
52-
add_action( 'plugins_loaded', 'gtm4wp_init' );
63+
add_action( 'plugins_loaded', 'gtm4wp_plugins_loaded' );
5364

5465
/**
5566
* Adds an action to declare compatibility with High Performance Order Storage (HPOS)

0 commit comments

Comments
 (0)