This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($){ | |
//Modify select2 ajax request to include a parent_id parameter, used by custom_acf_taxonomy_hierarchy() | |
acf.add_filter('select2_ajax_data', function( data, args, $input, field, instance ){ | |
var target_field_key = 'field_5c7634ca3413f'; //YOUR TARGET FIELD KEY HERE | |
if(data.field_key == target_field_key){ | |
var parent_id = 0; //by default we want terms with parent of 0 (top level) |