New debug notice WP_Styles::add was called incorrectly

Recently updated my local dev instal to Pro 6.7.13. Wordpress Version 6.9.1. PHP 8.1.13

This is running a base install with a child theme. The only function in the child theme is:
add_filter( 'x_enqueue_parent_stylesheet', '__return_true' );

I am getting this Notice:

Notice: Function WP_Styles::add was called incorrectly. The style with the handle “x-child-theme” was enqueued with dependencies that are not registered: x-theme. Please see Debugging in WordPress for more information. (This message was added in version 6.9.1.) in /localhost/prodev/wp-includes/functions.php on line 6131

I know that a notice is low on severity. But, it seems that something in the parent theme is causing the notice, as when I comment out that function it notice goes away. I like to keep debugging on while developing so would be great to have a solution as to what is causing this.

Hello @designerken,

Thanks for posting. This PHP Notice usually displays when you are using the Starter or Blank Stack. This is because the child theme style is still loaded without loading the default style.css with these custom stacks. I will add this to our enhancement tracker so that this PHP notice will be polished in future releases.

Best Regards.

@ruenel

Indeed we are using the Starter stack. So is the correct solution to remove the above mentioned filter from the functions.php file, or is there another solution to get rid of the warning? Its especial challenging when it shows in the page builder and throws the layout off in Cornerstone.

Hello @designerken,

While our developers are looking into this PHP Notice, you can temporarily edit the wp-content/themes/pro/framework/classes/Services/Enqueue.php file in lines 29 - 31 and have this code:

if ( is_child_theme() && wp_style_is( 'x-theme', 'registered' ) && apply_filters( 'x_enqueue_parent_stylesheet', false ) ) {
    wp_enqueue_style( 'x-child-theme', get_stylesheet_directory_uri() . '/style.css', [ 'x-theme' ] );
}

Thanks.

Thanks @ruenel

You are most welcome, @designerken.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.