I have searched your site but cannot find and fix this error I get:
Notice: Function wp_enqueue_style was called <strong>incorrectly</strong>. Scripts and styles should not be registered or enqueued until the <code>wp_enqueue_scripts</code>, <code>admin_enqueue_scripts</code>, or <code>login_enqueue_scripts</code> hooks. This notice was triggered by the <code>editor-buttons</code> handle. Please see <a href="https://wordpress.org/support/article/debugging-in-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 3.3.0.) in /wp-includes/functions.php on line 5835
In my functions.php I have:
//from: https://kinsta.com/blog/twenty-seventeen-theme/
// Also found: https://make.wordpress.org/training/handbook/lesson-plans/theme-school/child-themes/child-themes-twentyseventeen/
function childtheme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( 'parent-style' ),
wp_get_theme()->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'childtheme_enqueue_styles' );
// Method 2: Exclude a Category from WordPress Homepage Using Code
// As at: https://www.wpbeginner.com/wp-tutorials/how-to-exclude-a-category-from-your-wordpress-homepage/
function exclude_webapps_home( $query ) {
if ( $query->is_home ) {
$query->set( 'cat', '-49' ); // MUST use 'cat' for category and '-ID' for category ID
}
return $query;
}
add_filter( 'pre_get_posts', 'exclude_webapps_home' );
?>
What must I change? Can you help? I have no plugins or messed otherwise with the editor-buttons. I am on WordPress 6.1
wp_enqueue_style
only from within certain hooks. Whatever is callingchildtheme_enqueue_styles
is doing it wrong (though the caller and this function are probably both from the same provider).childtheme_enqueue_styles()
withoutfunction
in front of it.includes
probably means something else willinclude
it when it runs.