Home › Forums › Backend Issues (wp-admin) › Multi_select taxonomy from other blog › Reply To: Multi_select taxonomy from other blog
Hi @mikiamomik
I’m afraid this is hard to achieve. I think you can use the acf/fields/taxonomy/query hook to mark if a query is requested by ACF like this:
function my_taxonomy_query( $args, $field, $post_id ) {
// add custom args to be checked by get_terms hook
$args['test'] = 'testing';
// return
return $args;
}
add_filter('acf/fields/taxonomy/query', 'my_taxonomy_query', 10, 3);
After that, you can modify the returned terms using the “get_terms” hook like this:
function example_callback_taxonomy( $terms, $taxonomies, $args ) {
if(isset($args['test'])){ //check if it called from acf/fields/taxonomy/query
remove_action('get_terms', 'example_callback_taxonomy', 20);
// modify the args if you want
$args['order'] = 'ASC';
//get it from other blog
switch_to_blog($blog_id)
$terms = get_terms( 'category', $args );
restore_current_blog()
add_filter('get_terms', 'example_callback_taxonomy', 20, 3);
return $terms;
}
}
add_filter( 'get_terms', 'example_callback_taxonomy', 20, 3 );
The value wasn’t showing up because ACF is checking if your current blog has the taxonomy or not. You need to modify the select 2 field using jQuery and the acf/input/admin_footer.
I hope this makes sense.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.