Skip to main content
added 112 characters in body
Source Link
Tom J Nowell
  • 60.6k
  • 7
  • 77
  • 147

If you have a term, you can retrieve its meta via get_term_meta, this function works the same way as get_post_meta only it takes a term ID not a post ID

E.g.

if ( get_term_meta( $term_id, 'key', true ) === 'value' ) {
    // it has the value
}

Once you know this, it's just basic logic of looping over each term and checking them, which you already do in the code in your question

If you have a term, you can retrieve its meta via get_term_meta, this function works the same way as get_post_meta only it takes a term ID not a post ID

E.g.

if ( get_term_meta( $term_id, 'key', true ) === 'value' ) {
    // it has the value
}

If you have a term, you can retrieve its meta via get_term_meta, this function works the same way as get_post_meta only it takes a term ID not a post ID

E.g.

if ( get_term_meta( $term_id, 'key', true ) === 'value' ) {
    // it has the value
}

Once you know this, it's just basic logic of looping over each term and checking them, which you already do in the code in your question

added 112 characters in body
Source Link
Tom J Nowell
  • 60.6k
  • 7
  • 77
  • 147

If you have a term, you can retrieve its meta via get_term_meta, this function works the same way as get_post_meta only it takes a term ID not a post ID

E.g.

if ( get_term_meta( $term_id, 'key', true ) === 'value' ) {
    // it has the value
}

If you have a term, you can retrieve its meta via get_term_meta, this function works the same way as get_post_meta only it takes a term ID not a post ID

If you have a term, you can retrieve its meta via get_term_meta, this function works the same way as get_post_meta only it takes a term ID not a post ID

E.g.

if ( get_term_meta( $term_id, 'key', true ) === 'value' ) {
    // it has the value
}
Source Link
Tom J Nowell
  • 60.6k
  • 7
  • 77
  • 147

If you have a term, you can retrieve its meta via get_term_meta, this function works the same way as get_post_meta only it takes a term ID not a post ID