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?
- 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?
- Comma seperated list of ID’s as an array?
- post__in works but also prints the word Array
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- 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?
- How to create drop down for child categories of current taxonomy being viewed?
- How to add day number and initial to my post graph?
- How to validate register settings array
- Why does WP rename similar “term name”-slugs in separate taxonomies?
- Check if term object is in array
- Variable in Array Not Working
- How to use IN array properly in WordPress?
- 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?
- get_tags() return an empty array after added tags with wp_insert_term()
- 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
- 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?
- Selecting and outputting results from DB with an array
- Struggling with array and foreach loop
- Update post meta does not serialize array
- Redirect to another page using contact form 7? [closed]
- How to use json_decode a post_meta value? [duplicate]
- 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?
- 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
- Echo custom taxonomy slug
- 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
- 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
- WP Page Options Array
- Array is not working in Filter?
- Removing a taxonomy term
- return paginate_comments_links() as array
- Inserting a random number into an array [closed]
- Random element in get_post_meta array
- update_user_meta duplicates entry
- Sort query_terms_list for post_tags alphabetically
- Why are array_slice() and array_chunk() not working?
- Retrieve array items without page ID
- How do i fix this “call_user_func_array()” error
- How can I get the content of the current page in my loop while merging post-type
- wp_insert_post($post), add an array of values with update_post_meta
- update_post_meta adding to array instead of replacing value
- Add Array record to Meta Post
- How to output get_tags array list to select box
- How to add each letter, entity, special character from post title to array
- generate random slug when adding taxonomy
- Strange Behavior with update_option
- How i can extract data
- Show Tags of Custom Post Type outside of Loop
- “Undefined variable: array” Error In Displaying Post Tag
- How do I pull post from standard post format?
- Get all terms/slugs – used, not used & in hierarchical order
- The writing ( with foreach) of the keys of an array of objects to a new array produces fatal error
- Display taxonomy term slugs
- Use $wp_customize->add_control to create a selectable “Designed/Powered By” choices select w/ link in footer?
- Remove Custom Taxonomy Slug only without removing Custom post type slug in permalinks
- Tax query array terms display out of order
- Echo the key from a select-box in Array with get_option (Settings API)
- Updating wordpress user meta data array (unexpected multiple arrays)
- update_post_meta array issues
- taxonomy terms array not working
- Update Post Meta for Arrays — Remove/Replace Single Value from Multi Dimensional Array
- How do I retrieve a value from a multi – dimensional array using get_post_meta? [duplicate]
- Accessing array elements (get_pages)
- Printing out JSON array returned [closed]
- Fatal error in my WP
- SQL query add only posts with custom field to array
- Combine two foreach Arrays into one table row
- How to match data in multidimensional array of post_meta_data?
- Populate Array with values from another arrray [closed]
- how to separate array with commas? [closed]
- WordPress emails error regarding the argument type even if the type is correct
- Multipe array in meta_input
- Taxonomy Archive URL + Template