Site logo

Archived topic

block_categories deprecation notice in GP Premium Elements

2 replies · Started by Damien on September 1, 2022

Viewing posts 1–3 of 3

I saw that this issue was raised last November but there were no replies.

The deprecation notice is something like:
Deprecated: block_categories is deprecated since version 5.8.0! Use block_categories_all instead. in /wp-includes/functions.php on line 5585

I found in __construct() in gp-premium/elements/class-block-elements.php:

if ( version_compare( $GLOBALS['wp_version'], '5.8-alpha-1', '<' ) ) {
	add_filter( 'block_categories', array( $this, 'add_block_category' ) );
} else {
	add_filter( 'block_categories_all', array( $this, 'add_block_category' ) );
}

I think that the version_compare() function has trouble with the 'alpha-1' part (even though the docs say it should handle it).
If you change 5.8-alpha-1 to 5.8 then the deprecation notice goes away.

Please consider change the comparison string to '5.8'. I see that there's still about 35% on versions before 5.8 but I doubt many are on 5.8 alpha.

Thanks for the heads up! The alpha-1 check was working before - strange that it stopped.

Are you sure the issue is coming from GPP and not a different plugin?

I didn't step through the code but I removed the 'alpha-1' suffix and the message stopped showing in the wp-content/debug.log file.

This archived topic is closed to new replies.