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

Prevent fatal error when filtered block categories array is null. #200

Merged

Conversation

kmgalanakis
Copy link
Contributor

Description of the Change

This PR adds a fix to prevent a PHP fatal error when the value of the filtered block categories is not an array. This could happen when a third-party plugin or them is modifying the value of the filtered block categories with a non-appropriate value.

Closes #199

How to test the Change

Add the following to your theme's function.php file

add_action( 'block_categories_all', 'nullify_block_categories' );
function nullify_block_categories() {
	return null;
}

Changelog Entry

Fixed - Prevent PHP fatal error when the value of the filtered block categories is not an array.

Credits

Props @kmgalanakis

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@jeffpaul jeffpaul merged commit 2b8eea9 into develop May 16, 2024
14 checks passed
@jeffpaul jeffpaul deleted the feature/prevent-fatal-error-on-empty-block-categories branch May 16, 2024 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:code-review This requires code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fatal error in safe-svg/includes/blocks.php:51 when accessing the Wordpress Customizer
3 participants