Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

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 joelstransky/42610a8f4bba13f7ef77e051087e8115 to your computer and use it in GitHub Desktop.
Save joelstransky/42610a8f4bba13f7ef77e051087e8115 to your computer and use it in GitHub Desktop.
Wordpress: Create relationship between two taxonomy's using ACF
<?php
$all_tax_a_terms = get_terms( array( 'taxonomy' => 'taxonomy_a', 'hide_empty' => false) );
foreach ($all_tax_a_terms as $a_term) {
$b_terms_set_to_a_term = get_terms( array(
'taxonomy' => 'taxonomy_b',
'meta_key' => 'acf-key-for-taxonomy-b',
'meta_value' => $a_term->slug,
'hide_empty' => false )
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment