Home › Forums › Backend Issues (wp-admin) › Repeater not returning posts in english language
I have an acf that takes the woocommerce products (which are not translatable, so there is only the italian version), this is the structure:
acf_add_local_field_group(array(
'key' => 'group_65017e7235881',
'title' => 'Home CPO',
'fields' => array(
array(
'key' => 'field_65017e798dde7',
'label' => 'Orologi in evidenza',
'name' => 'orologi_in_evidenza',
'type' => 'repeater',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'collapsed' => '',
'min' => 0,
'max' => 0,
'layout' => 'table',
'button_label' => '',
'sub_fields' => array(
array(
'key' => 'field_65017e8a8dde8',
'label' => 'Orologio',
'name' => 'orologio',
'type' => 'post_object',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'post_type' => array(
0 => 'product',
),
'taxonomy' => array(
0 => 'product_cat:rolex-cpo',
),
'allow_null' => 0,
'multiple' => 0,
'return_format' => 'object',
'ui' => 1,
),
),
),
),
'location' => array(
array(
array(
'param' => 'page_template',
'operator' => '==',
'value' => 'index-cpo.php',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => 1,
'description' => '',
));
If I use the italian language, then the repeater will display all the products available. Otherwise, if I switch to english language the repeater doesn’t show anything.
This issue is kinda weird ’cause in the english version I can see all the products from the woocommerce dashboard but not from the repeater.
I’m trying to change the lang parameter that is sent from the ajax request of acf, so I did this:
function customize_acf_query($args, $field, $post_type)
{
$args['lang'] = 'it';
return $args;
}
add_filter('acf/fields/post_object/query', 'customize_acf_query', 10, 3);
but again, the acf doesn’t display any products. Could someone help me?
Thanks in advance!
You must be logged in to reply to this topic.
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.