Home › Forums › Add-ons › Repeater Field › get_field and sub_field always retunrs false
Hi guys i having a pretty consisten isue here with some fields
im creating this structure
/*Tips*/
array(
'label' => 'Seccion Tips',
'name' => 'sec_mgz_tips',
'display' => '',
'min' => '',
'max' => '',
'sub_fields' => array(
array(
'key' => 'field_5e78e',
'label' => 'Tips',
'name' => 'sec_bt_tips',
'type' => 'repeater',
'column_width' => '',
'sub_fields' => array(
array(
'key' => 'field_527178f',
'label' => 'Tip Link',
'name' => 'sec_bt_tip',
'type' => 'text',
'column_width' => '',
'save_format' => 'id',
),
array(
'key' => 'field_5178f',
'label' => 'Titulo',
'name' => 'sec_bt_tip_title',
'type' => 'text',
'column_width' => '',
'save_format' => 'id',
),
),
'row_min' => '',
'row_limit' => 3,
'layout' => 'row',
'button_label' => 'Agregar Tip',
),
),
),
/*Tips end*/
Easy this creates a repeater with two fields link and link name
the problem is that when i try to get the data from this field it shows nothing
when i run
$subfield = get_field('sec_mgz_tips');
var_dump($subfield);
Prints NULL
when i run
$subfield = get_sub_field('sec_mgz_tips');
var_dump($subfield);
Prints FALSE
when i run
$sections = get_field('bt_secciones');
var_dump($sections);
Prints
array(3) {
[0]=>
array(2) {
["acf_fc_layout"]=>
string(11) "sec_bt_post"
["sec_post_posts"]=>
array(3) {
[0]=>
int(175220)
[1]=>
int(175219)
[2]=>
int(175062)
}
}
[1]=>
array(2) {
["acf_fc_layout"]=>
string(12) "sec_bt_texto"
["sec_c_textos"]=>
array(1) {
[0]=>
array(5) {
["sec_bt_tnumeracion"]=>
bool(true)
["sec_bt_ttitle"]=>
string(65) "Si se activa, tendrá que agregar el numero de orden al título 1"
["sec_bt_tubicaimg"]=>
string(1) "0"
["sec_bt_tdescripcion"]=>
string(598) "
8. You hate staying at other people’s houses because you miss your own bed too much. 9. You consider 10pm a really late night. 10. You would never start watching a film after 9pm. 11. You are perfectly capable of NOT binge-watching box sets on Netflix. 12. The best thing about going on holiday is getting home and crawling into your own bed. 13. You get into your pyjamas as soon as you are home for the day.
"
["sec_bt_timages"]=>
array(1) {
[0]=>
array(1) {
["sec_bt_timagen"]=>
int(175232)
}
}
}
}
}
[2]=>
array(2) {
["acf_fc_layout"]=>
string(12) "sec_mgz_tips"
["sec_bt_tips"]=>
array(2) {
[0]=>
array(2) {
["sec_bt_tip"]=>
string(6) "LINK 1"
["sec_bt_tip_title"]=>
string(5) "TIP 1"
}
[1]=>
array(2) {
["sec_bt_tip"]=>
string(6) "LINK 2"
["sec_bt_tip_title"]=>
string(5) "TIP 2"
}
}
}
}
As you can see in the array the field does exist so i don’t know why is not printing its values
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!
❓Ever wondered when and why ACF uses JSON instead of the database? Check out our summary of the most recent session of ACF Chat Friday for the answer, and make sure to register for the next session.
— Advanced Custom Fields (@wp_acf) February 23, 2023
👉 https://t.co/3UtvQbDwNmhttps://t.co/wfFEVcXVKc
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.