Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation warning for block_categories #45

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

snim2
Copy link
Contributor

@snim2 snim2 commented Jun 18, 2024

PHP Deprecated: Hook block_categories is deprecated since
version 5.8.0! Use block_categories_all instead.

See:
https://developer.wordpress.org/reference/hooks/block_categories/
https://developer.wordpress.org/reference/hooks/block_categories_all/

Notes

This plugin is used on:

{
  "0.2.0": [
    "dxw/cass-review"
  ],
  "0.4.0": [
    "dxw/dhsc-intranet"
  ],
  "0.4.1": [
    "dxw/saluki-test-site",
    "dxw/settle",
    "dxw/valleys-to-coast"
  ]
}

Testing

composer install
./vendor/bin/kahlan spec

@snim2 snim2 marked this pull request as draft June 18, 2024 16:10
@snim2 snim2 force-pushed the fix/block-categories-deprecation branch from b9c33fc to a0248d5 Compare June 18, 2024 16:11
@snim2 snim2 marked this pull request as ready for review June 18, 2024 16:11
@@ -5,7 +5,7 @@ class BlockCategory implements \Dxw\Iguana\Registerable
{
public function register()
{
add_filter('block_categories', [$this, 'newBlocksCategory'], 10, 1);
add_filter('block_categories_all', [$this, 'newBlocksCategory'], 10, 1);
}

public function newBlocksCategory($categories)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that we ignore the second parameter here which is the main thing that's changed in the new filter (WP_Post -> WP_Block_Editor_Context)

@snim2 snim2 merged commit bdeac64 into main Jun 19, 2024
5 checks passed
@snim2 snim2 deleted the fix/block-categories-deprecation branch June 19, 2024 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants