Support » Plugin: Events Manager » Hide Category from Search Category Dropdown Menu

  • Resolved deez


    Hi there,

    I’ve looked all over these forums and performed Google searches until my eyes bleed.

    I’m looking to simply hide specific categories from the Search function’s Category Dropdown menu. Can someone inform me how this is possible?

    Thanks very much. Amazing plugin!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support caimin_nwl


    NetWebLogic Support


    Glad you’re enjoying the plugin.

    The best way to do this would be to copy and modify the search categories template under/events-manager/templates/templates/search. This tutorial shows you how to do that in an upgrade safe way:

    Using Template Files

    You’d then need to edit the wp_dropdown_categories function in the template to exclude the category IDs you don’t want to display.



    Hi Caimin,

    Thanks for your help! I’m a little bit of an amateur with PHP. Can you help me figure out what code I would add to this file that would allow me to exclude categories in the dropdown menu by IDs?

    <?php $args = !empty($args) ? $args:array(); /* @var $args array */ ?>
    <!-- START Category Search -->
    <div class="em-search-category em-search-field">
    	<label><?php echo esc_html($args['category_label']); ?></label>
    		EM_Object::ms_global_switch(); //in case in global tables mode of MultiSite, grabs main site categories, if not using MS Global, nothing happens
    		wp_dropdown_categories(array( 'hide_empty' => 0, 'orderby' =>'name', 'name' => 'category', 'hierarchical' => true, 'taxonomy' => EM_TAXONOMY_CATEGORY, 'selected' => $args['category'], 'show_option_none' => $args['categories_label'], 'class'=>'em-events-search-category'));
    		EM_Object::ms_global_switch_back(); //if switched above, switch back
    <!-- END Category Search -->
    Plugin Support caimin_nwl


    NetWebLogic Support

    The line you need to edit is the one that starts wp_dropdown_categories. Try using this line instead:

    wp_dropdown_categories(array( 'exclude' => '1,2','hide_empty' => 0, 'orderby' =>'name', 'name' => 'category', 'hierarchical' => true, 'taxonomy' => EM_TAXONOMY_CATEGORY, 'selected' => $args['category'], 'show_option_none' => $args['categories_label'], 'class'=>'em-events-search-category'));

    You’ll see there’s an extra exclude parameter at the start. Just change 1 and 2 to the category IDs you want to exclude. You can add as many more as you like, separating each with a comma.

    This might help:




    Thank you! Worked perfectly.
    You are a gentleman and a scholar.

    i want to exclude the event categories from search in my web. i had used search every-thing plugin for search so please help me how to exclude the event-categories from it.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hide Category from Search Category Dropdown Menu’ is closed to new replies.