[Support request] block_categories deprecation notice in GP Premium Elements

Home Forums Support [Support request] block_categories deprecation notice in GP Premium Elements

Home Forums Support block_categories deprecation notice in GP Premium Elements

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #2330218
    Damien

    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.

    #2332012
    Tom
    Lead Developer
    Lead Developer

    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?

    #2332144
    Damien

    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.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.