Merge pull request #64 from studiopress/joshua/fix-early-trigger

Defer textdomain loading and admin menu registration to fix early translation notice
This commit is contained in:
Joshua Pregua
2025-12-02 22:16:44 +08:00
committed by GitHub
2 changed files with 13 additions and 3 deletions
@@ -51,8 +51,18 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
$menu_ops = array(
'submenu' => array(
'parent_slug' => 'genesis',
'page_title' => __( 'Genesis - Simple Sidebars', 'genesis-simple-sidebars' ),
'menu_title' => __( 'Simple Sidebars', 'genesis-simple-sidebars' ),
/*
* These strings intentionally avoid using the plugin text
* domain here because this method can be called before the
* `init` action (via `genesis_setup`). Using `__()` with the
* `genesis-simple-sidebars` domain at that point would cause
* WordPress 6.7+ to emit a "_load_textdomain_just_in_time
* was called incorrectly" notice. Other plugin strings remain
* fully translatable once the text domain is loaded on `init`.
*/
'page_title' => 'Genesis - Simple Sidebars',
'menu_title' => 'Simple Sidebars',
),
);
+1 -1
View File
@@ -86,7 +86,7 @@ class Genesis_Simple_Sidebars {
*/
public function init() {
$this->load_plugin_textdomain();
add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
add_action( 'admin_notices', array( $this, 'requirements_notice' ) );