Skip to content

Instantly share code, notes, and snippets.

@remcotolsma
Created August 29, 2019 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remcotolsma/50af12324d57d882fa628052b0f53964 to your computer and use it in GitHub Desktop.
Save remcotolsma/50af12324d57d882fa628052b0f53964 to your computer and use it in GitHub Desktop.
Providers and slots GEO query WordPress.
<?php
$providers_query = new WP_Query(
array(
'post_type' => 'provider',
'tax_query' => array(
array(
'taxonomy' => 'country',
'field' => 'slug',
'terms' => 'nl',
),
),
)
);
$provider_slugs = wp_list_pluck( $providers_query->posts, 'post_name' );
$slots_query = new WP_Query(
array(
'post_type' => 'slot',
'tax_query' => array(
array(
'taxonomy' => 'game_provider',
'field' => 'slug',
'terms' => $provider_slugs,
),
),
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment