Last active
July 2, 2024 01:04
-
-
Save AlexGStapleton/44e459890afa06eefeb4621e4d682145 to your computer and use it in GitHub Desktop.
SiteOrigin Blog Widget. Filter out non-top-level categories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'siteorigin_widgets_blog_filter_categories_output', function( $categories ) { | |
if ( empty( $categories ) ) { | |
return $categories; | |
} | |
return array_filter( $categories, function( $category ) { | |
return $category->parent === 0; | |
} ); | |
}, 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment