• Resolved Marie-Aude

    (@marie-aude)


    Hi,

    I’m using Pronamic company and pronamic google maps together, and I’m building a specific archive template for the location taxonomy.

    Location is activated for both normal posts and companies post type, but I want to show on the mash up only the companies.

    The problem is that, on a specific location, I cannot filter per taxonomy value.
    All companies are shown on the maps.

    pronamic_google_maps_mashup(
     array (
    	'post_type' => 'pronamic_company',
            'no-paging' => true ,
            'tax_query' => array (
                    'taxonomy' => 'pronamic_company_region' ,
                     'field' => 'id' ,
                     'terms' => $termid )
    	),
     array(
           'width'          => 650,
           'height'         => 350,  ),
      )
    )

    $termid is a variable that’s populated earlier in the code. I checked it with a vardump, and even hardcoded it, and I also tried using the slug, and nothing works : it always displays all locations.

    The post type is correctly filtered.

    The website is currently in development, on localhost

    Any hint ?

    https://www.ads-software.com/plugins/pronamic-google-maps/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello Marie-Aude.

    tax_query takes an array of arrays. Instead try.

    pronamic_google_maps_mashup(
     array (
    	'post_type' => 'pronamic_company',
            'no-paging' => true ,
            'tax_query' => array (
                    array(
                     'taxonomy' => 'pronamic_company_region' ,
                     'field' => 'id' ,
                     'terms' => $termid )
                    )
    	),
     array(
           'width'          => 650,
           'height'         => 350,  ),
      )
    )
    Thread Starter Marie-Aude

    (@marie-aude)

    Thank you ! I knew I was making a stupid mistake somewhere.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘tax_query not taken into account’ is closed to new replies.