Skip to content

Activating theme on WP 6.8.2 displays a warning when WP_DEBUG_DISPLAY is on #13

Description

@TheRealBoerke

Description

After activating the theme on our WordPress site, which apparently had WP_DEBUG_DISPLAY turned on by our hosting provider, we were presented with the following warning at the top of our site:

_load_textdomain_just_in_time function was called incorrectly (or something similar).

After some troubleshooting in a clean development container, I found the problem in block_pattrern.php. Moving

$this->setup_properties(); // <-- uses __() too early

from the __construct() function to the run() function, fixed the issue.

Hope this helps, and a fix will be available in the next update.

Step-by-step reproduction instructions

  1. Enable WP_DEBUG_DISPLAY
  2. Install and activate the [non-profit FSE] theme

The warning displays at the top

Screenshots, screen recording, code snippet or Help Scout ticket

The working code:

public function __construct() {
    add_action( 'init', [ $this, 'run' ] );
}

public function run() {
    $this->setup_properties();         // <-- now runs on init, safe
    $this->register_categories();
    $this->register_patterns();
}

Environment info

No response

Is the issue you are reporting a regression

No

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions