WPIntell

Source evidence

Hide empty categories in shortcode

WPAdverts – Classifieds Plugin · support · 2025-06-22T13:59:00+00:00

neutralsentiment
mediumseverity
0.53relevance
4replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

5 / 22 rows with source links

22.7% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

17 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
teeboy4real resolved
Hi please can you add feature or new parameter to hide categories with empty ads or zero ads in [adverts_categories] shortcode, I created lots of categories but I dont want users viewing empty categories without ads, only the categories containing ads should be visible. Thanks Hi, you can hide the empty categories by adding the below code snippet in your theme functions.php file (or even better by creating a new blank plugin and pasting the code there https://wpadverts.com/blog/how-to-use-code-snippets-in-wordpress/ ) add_filter( "adverts_categories_query", function( $args ) { $args["hide_empty"] = 1; return $args; } ); Thanks a lot the code worked, but does not work for sub categories when using (show=all) parameters For sub-categories you will need another code snippet add_filter( "adverts_categories_query_sub", function( $args ) { $args["hide_empty"] = 1; return $args; } ); Thanks a lot

Comments

4 shown
Greg Winiarski 2025-06-23T09:44:00+00:00

Hi, you can hide the empty categories by adding the below code snippet in your theme functions.php file (or even better by creating a new blank plugin and pasting the code there https://wpadverts.com/blog/how-to-use-code-snippets-in-wordpress/ ) add_filter( "adverts_categories_query", function( $args ) { $args["hide_empty"] = 1; return $args; } );

teeboy4real 2025-06-23T21:30:00+00:00

Thanks a lot the code worked, but does not work for sub categories when using (show=all) parameters

Greg Winiarski 2025-06-24T08:42:00+00:00

For sub-categories you will need another code snippet add_filter( "adverts_categories_query_sub", function( $args ) { $args["hide_empty"] = 1; return $args; } );

teeboy4real 2025-06-25T02:43:00+00:00

Thanks a lot