10up / safe-svg

Enable SVG uploads and sanitize them to stop XML/SVG vulnerabilities in your WordPress website.
https://wordpress.org/plugins/safe-svg/
GNU General Public License v2.0
263 stars 31 forks source link

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

Closed kmgalanakis closed 3 months ago

kmgalanakis commented 3 months ago

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: