Answer the question
In order to leave comments, you need to log in
How to change the selection options in the select from AdvancedCustomFields from the front-end?
I use ACF, added select to select a buyer - joxi.ru/82QYbb0t14a042 . It is necessary to use a function through the code to change the elements that can be selected by adding new ones.
How can I do that? Found www.advancedcustomfields.com/resources/dynamically... but I don't understand it, it's not. Lack of English skill
Answer the question
In order to leave comments, you need to log in
По ссылке это именно оно.
function acf_modify_client_choices( $field ) {
// $field содержит весь массив данных этого поля 'client'
// можете сделать var_dump( $field );
// варианты выбора этого поля содержатся в $field['choices']
// var_dump( $field['choices'] ) покажет что внутри
// модифицируете данные
// возвращаете обратно
return $field;
}
add_filter('acf/load_field/name=client', 'acf_modify_client_choices');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question