Perhaps array_map ?
This will give you an array of term names which matched your slugs in $active_filters:
$matched_terms = array_map(function($term) use ($active_filters){
if(in_array($term->slug, $active_filters)){
return $term->name;
}
else{
return false;
}
}, $tax_terms);
//remove the empty array elements which came from terms which didn't match a slug
$matched_terms = array_filter($matched_terms);
Related Posts:
- Sort a custom post type array numerically
- WordPress, result array of ‘post_name’
- wp_set_object_terms not accepting variable array
- How to get a taxonomy term name by the slug?
- Nice way to print_r arrays
- What is wp_insert_term “alias_of” arg for?
- Why does get_users suddenly return duplicates?
- Get list of all registered post types slugs
- Exclude specific slug in ‘get_terms’
- WordPress: How to use post_class() in an echo
- array_pop() expects array, boolean given for $event_type_term ->slug
- Get_term_by only returns one item from array
- How do I pass an array as an argument to a WP-CLI command?
- Can we have same term slug in different taxonomies?
- Updating wp_options with an array on save_post results in duplicated entries
- Passing a variable into Contact Form 7 [closed]
- Comma seperated list of ID’s as an array?
- WP_insert_term how to insert multiple values as taxonomny term?
- update_post_meta from data in multidimensional array created from a form
- wp_update_term not creating new unique slug
- post__in works but also prints the word Array
- Make Selected Mutiselect Items “selected”
- How to edit/remove a term that’s in multiple taxonomies?
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- settings api store multiple array
- if is_singular array not working as expected
- Get Term names from WP Term Object
- How do I update a specific object in an array, in user meta?
- Get posts id in array by meta value and key
- How to create drop down for child categories of current taxonomy being viewed?
- How to save array of datas in option page by setting api?
- How to add day number and initial to my post graph?
- taxonomy/category term in URL slug irrelevant for post?
- How to validate register settings array
- How to check an array of $curauth fields?
- Why does WP rename similar “term name”-slugs in separate taxonomies?
- Outputting an array of term meta values in a custom WooCommerce tab?
- Problem with wp_update_post
- Show all wp_get_post_terms slugs
- Check if term object is in array
- Replace text inside a huge multidimensional array
- Variable in Array Not Working
- How to use IN array properly in WordPress?
- Does WordPress limit the length of slug names for Post Meta or Terms?
- WordPress Plugin Dev: Using array for WP options
- tax_query operator woes
- Only a part of array is stored in transient – what could be causing this?
- update_post_meta() with a modified array?
- get_tags() return an empty array after added tags with wp_insert_term()
- Get custom category image from menu
- How to get update_post_meta output to include string length
- Return array keys and values
- How pass a 0 in $atts?
- Display Taxonomy Terms in an option tag with value being the slug
- Changing taxonomy term by slug (wp_update_term)
- How to save data of an input field to an array
- get a simple array of all of the term names that exist in all taxonomies
- Retrieving multiple values to the Post Meta (using an array)
- Echoing a variable inside a function
- Stuck with a Custom Field Check box Array
- Compare with WP Meta Query
- How to Translate a string of an array inside a class?
- How to pass conditional array to wp_localize_script
- Sort order by slug for looped child terms of custom taxonomy
- Modify foreach loop for social sharing links?
- Combine get_page_by_title to exclude pages from wp_list_pages
- Plugin settings page checkbox not saving – one options array with sub array
- Selecting and outputting results from DB with an array
- Struggling with array and foreach loop
- Update post meta does not serialize array
- Customizer Settings in Arrays
- Get posts from specific taxonomy term
- Redirect to another page using contact form 7? [closed]
- WordPress i18n in Array throws Error
- How to use json_decode a post_meta value? [duplicate]
- How to decipher the following array
- Save meta box values as an array to wp_postmeta
- How to display line breaked meta values in table?
- Organizing and grouping an array by year
- Can anybody provide me with a function to generate slugs?
- List taxonomy term slugs within shortcode (do_shortcode)
- How can I access string value in an array?
- array_filter warning – wp-includes/post.php line 3148
- Hide sidebar if post_type is in array
- Array in meta key?
- Echo custom taxonomy slug
- Saving array keep adding length of array
- Query posts using custom taxonomy and selected terms
- Obtaining values from objects
- How to get a page array and category array going at the same time?
- Set term on an attachment using wp_set_object_terms and want to display the full term text but it’s showing a slug instead
- get_the_terms, whether I should use string or array as the second parameter?
- Tax query with multiple terms in pre_get_posts
- Obtaining array item from WordPress revisions output
- How to change a WordPress term’s slug before saving
- Print specific values stored in a post meta array
- get_terms() returns Trying to get property of non-object error for custom taxonomy
- Display Terms Comma separated and Hyperlinked
- Do not replicate items if they exists in a foreach loop
- Get term slug by term id and then explode it