Changes between Version 8 and Version 9 of Ticket #59000, comment 13
- Timestamp:
- 08/25/2023 10:55:20 PM (14 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #59000, comment 13
v8 v9 3 3 Also there is some [https://core.trac.wordpress.org/browser/tags/6.3/src/wp-includes/theme-previews.php#L78 "loose" code in theme-previews.php] that should probably not be there. Adding of actions and filters should be in `default-filters.php` unless there is a need for a (well documented) exception. 4 4 5 Looking at the [https://github.com/WordPress/gutenberg/issues/53284 original issue], it seems better to warn plugin authors that methods like `$wp_theme->get_stylesheet()` cannot be used before the `plugins_loaded` action (which runs immediately after all plugins and pluggable.php are loaded). Then add a "doing it wrong" in these methods similarly to the way in script-loader.php (i.e. check if the `plugins_loaded` action has run and call doing_it_wrong if not). This will also ensuresimilar errors do not happen in the future.5 Looking at the [https://github.com/WordPress/gutenberg/issues/53284 original issue], it seems better to warn plugin authors that methods like `$wp_theme->get_stylesheet()` cannot be used before the `plugins_loaded` action (which runs immediately after all plugins and pluggable.php are loaded). Then add a "doing it wrong" in these methods similarly to the way in script-loader.php (i.e. check if the `plugins_loaded` action has run and call doing_it_wrong if not). This will ensure that the `stylesheet`, `template`, etc. filters do not run too early and similar errors do not happen in the future.