Support » Plugin: WP Store Locator » Don’t show categories

  • Resolved inula


    Hi Tijmen,

    In WP StoreLocator I have 4 categories.
    On a page I want visitors to choose between cat-1 and cat-2.
    How do I prevent cat-3 and cat-4 form showing up?

    wpsl category_type="checkboxes" category_selection="cat-1, cat-2"


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Tijmen Smit


    Excluding categories from the dropdown can be done with the code below.

    You will have to replace 1 and 2 with the correct category id‘s, and the ‘your-page-permalink’ with the permalink from your page.

    add_filter( 'wpsl_dropdown_category_args', 'custom_dropdown_category_args' );
    function custom_dropdown_category_args( $args ) {
        if ( is_page( 'your-page-permalink' ) )  {
            $args['exclude'] = array('1','2'); // The category ID.
        return $args;

    The code has to go in the functions.php inside your active theme folder.

    Great Tijmen!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Don’t show categories’ is closed to new replies.