55
66namespace Geniem \ACF \Fields ;
77
8- add_action ( 'acf/init ' , function () {
8+ add_action ( 'acf/init ' , function () {
99 /**
1010 * ACF MultisiteTaxonomy Relationship class
1111 */
@@ -79,7 +79,6 @@ function get_ajax_query( $options = [] ) {
7979 ]
8080 );
8181
82-
8382 // bail early if a taxonomy does not exist
8483 $ taxonomies_exist = $ this ->taxonomies_exist ( $ field ['taxonomy ' ] );
8584
@@ -201,7 +200,7 @@ protected function get_all_terms( $args ) {
201200 ] );
202201
203202 // parameters changed in version 4.5
204- if ( acf_version_compare ( 'wp ' , '< ' , '4.5 ' ) ) {
203+ if ( acf_version_compare ( 'wp ' , '< ' , '4.5 ' ) ) {
205204 return get_terms ( $ args ['taxonomy ' ], $ args );
206205 }
207206
@@ -307,12 +306,15 @@ public function render_field( $field ) {
307306 // force value to array
308307 $ field ['value ' ] = acf_get_array ( $ field ['value ' ] );
309308
309+ $ nonce = wp_create_nonce ( 'acf_field_ ' . $ this ->name . '_ ' . $ field ['key ' ] );
310+
310311 // vars
311312 $ div = [
312313 'class ' => 'acf-multisite-taxonomy-field ' ,
313314 'data-ftype ' => $ field ['field_type ' ],
314315 'data-taxonomy ' => $ field ['taxonomy ' ],
315316 'data-allow_null ' => $ field ['allow_null ' ],
317+ 'data-nonce ' => $ nonce ,
316318 ];
317319
318320 // get taxonomy
@@ -331,13 +333,13 @@ public function render_field( $field ) {
331333
332334 $ field ['multiple ' ] = 0 ;
333335
334- $ this ->render_field_select ( $ field );
336+ $ this ->render_field_select ( $ field, $ nonce );
335337
336338 } elseif ( $ field ['field_type ' ] == 'multi_select ' ) {
337339
338340 $ field ['multiple ' ] = 1 ;
339341
340- $ this ->render_field_select ( $ field );
342+ $ this ->render_field_select ( $ field, $ nonce );
341343
342344 } elseif ( $ field ['field_type ' ] == 'radio ' ) {
343345
0 commit comments