You can detect if you are in the frontend using the function is_admin()
, like so:
add_filter('get_term', 'filter_term_name', 10, 2);
function filter_term_name($term, $taxonomy) {
// return the term untuched if you are in the admin
if( is_admin() ) {
return $term;
}
if ($taxonomy == 'my-taxonomy') {
// numeric value of term in another taxonomy
$meta_value = get_term_meta($term->term_id, '_my_meta_name', true);
if ($meta_value) {
// get name of meta value from another taxonomy
$value = get_term($meta_value, 'another-taxonomy');
if ($value) {
$term->name = sprintf('%s, %s', $value->name, $term->name);
}
}
}
return $term;
}
Related Posts:
- Adaptive product filters for WooCommerce
- Display post after choice two taxonomy terms
- is it possible to add “extra” table nav to edit-tags.php screens?
- Restrict filter to run only inside specific function
- How to always display a specific post from the search result first
- What hooks/filters are there to alter selected terms on post save?
- How to display term description in empty terms archive?
- Taxonomy Custom Column – ‘manage_{TAXONOMY}_custom_column’ filter only passing 2 arguments
- Is there a filter hook that I can use to change how taxonomy term names are displayed?
- How to order by taxonomy using wp_query
- Filter taxonomy admin pagination
- Insert term when page is published – avoid duplicates after edits
- Filter custom post type using multiple taxonomy dropdowns
- Create Search Form to Filter Through Terms
- Sorting a specific taxonomy by archive date using URL
- Create a pre-filtered version of the Media Library
- How to query if meta_key does exist or not?
- How to stop the deduction in “wp_term_taxonomy” count, when the post is deleted?
- Include get_term_link inside search
- List all categories that have results in a query
- Post filter with multiple checkbox taxonomy terms
- Admin view: filter posts by whether they have specific taxonomy attached
- WP Job Manager – display search results from custom search form in taxonomy-job_listing_category page
- Turn wp_tag_cloud into a front-end filter
- How to create a list of terms who’s posts also have a predefined external term?
- Is There a Difference Between Taxonomies and Categories?
- Sanitize and data validation with apply_filters() function
- How many filter/action hooks are healthy?
- Valid characters for actions, hooks and filters
- How to hook into unregistering a widget instance?
- How do I use the ‘http_request_host_is_external’ filter
- get_option() filtering and getting out of recursion
- Get excerpt from $post->post_content
- Better way to enforce category hierarchy in post_categories_metabox?
- AJAX filter posts on click based on category
- How can I filter Microsoft Word gunk from pasted content?
- How do I know if author field was changed on post save?
- WordPress 3.5+ upload tool filter
- Some questions regarding filter
- Use content custom filter for all shortcodes
- Filter all html output
- Which hook is fired when inserting media into a post
- How to specify which category of the post to use in case of multiple categories
- Return array of images after content
- return values from hooks do_action and apply_filters, which is better
- get_title without filter(the_title)
- How can filters be run when they are never applied?
- Have a Custom Post Type index page display taxonomy items instead of posts
- get_bookmarks filter not supplying query argument (wp 3.1)
- List Terms in Category
- add_filter does not work as expected
- Using wp_handle_upload() to Direct Specific Path by Using $overrides
- Filter to shorten column content on edit-tags.php
- Formatting get_post content doesn’t allow JS content to function properly
- Proper after_setup_theme and wp_head cleanup
- Why doesn’t remove_action work in my plugin?
- Using a filter to modify Genesis wp_nav_menu
- Get Custom Taxonomy Terms by Date
- How can I change the email that is inside the default email texts of wordpress?
- How to Order a list of taxonomies? orderby?
- Modify message displayed on post save
- Something is filtering my shortcodes… Can’t figure out what
- Build filter for post-type + multi taxonomies + multi terms
- Remove actions/filters that are set with create_function()
- I need to hook and change language of facebook sdk
- change “missing attachment” text functions.php
- Use has_filter on comment_post
- Hook in a sidebar widget and add some markup
- How can I query all post with currrent taxonomy term?
- return get_the_tag_list with whitespace removed
- How do I add tags to entire comments, not just their text
- How to automatically create a terms based on each post of a post type
- WordPress how to prevent URL encoding in URL of taxonomy terms
- ‘manage_users_custom_column’ is a filter, but ‘manage_posts_custom_column’ is an action. Why?
- Modify author url display in edit-comments.php
- add_filter( ‘the_title’ gets through this if statement twice
- Changing the category for existing Gutenberg blocks
- Filter Post Title without affecting screen-reader-text
- Hook to change the site URL
- How can I see exactly what arguments are being passed through a filter so that I may modify them?
- Widget image reorganize layout
- Restrict retrieved terms by category?
- WordPress set featured image to first image of the post
- Set Microsoft Word links to open in new window/tab
- WordPress get_avatar filter to match logins
- Modify category listing API response
- Auto-generated excerpt with shortcode and read more button/text link
- Converting restricted html in comments to bbcode
- Change shortcode output (filter?)
- How do I add a class to all sidebars to let a Google Custom Search Engine know not to index the content?
- How to replace all images in all posts and pages with a different size?
- How to add a class to Buddypress avatars in the Activity stream? [closed]
- using posts_where for meta data on pre_get_posts
- Updating User Profile on Registration
- Echo used hierarchical taxonomies parent name
- How properly write function to filter content in a template for plugin “multiple content blocks”
- ACF Load Field Groups Programmatically [closed]
- Why does using excerpt_more filter change link location?
- How to elect position of new item output in a dropdown when using add_filter
- Filter a custom post type by custom field in admin