Home › Forums › ACF PRO › Get_fields() / option page gives empty array › Reply To: Get_fields() / option page gives empty array
Hello,
I have the same issue, I try to get all the values from the options page but it only returns the keys + true/false, and not the complete array.
example: $wds_settings = get_fields( 'options' );
Array
(
[partners] => 5
[favicon] =>
[logo] => 68
[copy] => © 2016
[container] => container
[default_text_color] => #58595b
[default_font_size] => 14
[default_text_line_height] => 16
[h1_repeater] => 1
[h3_repeater] => 1
[h4_repeater] => 1
[h5_repeater] => 1
[h6_repeater] => 1
[h2_repeater] => 1
[main_menu] => 1
)
When the expected result is:
Array
(
[partners] => Array
(
[0] => Array
(
[image] => 282
[option] => none
[link] =>
[download] =>
)
[1] => Array
(
[image] => 279
[option] => none
[link] =>
[download] =>
)
[2] => Array
(
[image] => 278
[option] => none
[link] =>
[download] =>
)
[3] => Array
(
[image] => 281
[option] => pdf
[link] =>
[download] => http://somesite.com/wp-content/uploads/2016/03/iso.pdf
)
[4] => Array
(
[image] => 286
[option] => pdf
[link] =>
[download] => http://somesite.com/wp-content/uploads/2016/03/inci.pdf
)
)
[favicon] =>
[logo] => Array
(
[ID] => 68
[id] => 68
[title] => Wondercom
[filename] => logo.png
[url] => http://somesite.com/wp-content/uploads/2016/03/logo.png
[alt] =>
[author] => 1
[description] =>
[caption] =>
[name] => logo
[date] => 2016-03-16 13:56:00
[modified] => 2016-03-16 13:56:06
[mime_type] => image/png
[type] => image
[icon] => http://somesite.com/wp-includes/images/media/default.png
[width] => 163
[height] => 23
[sizes] => Array
(
[thumbnail] => http://somesite.com/wp-content/uploads/2016/03/logo-150x23.png
[thumbnail-width] => 150
[thumbnail-height] => 23
[medium] => http://somesite.com/wp-content/uploads/2016/03/logo.png
[medium-width] => 163
[medium-height] => 23
[medium_large] => http://somesite.com/wp-content/uploads/2016/03/logo.png
[medium_large-width] => 163
[medium_large-height] => 23
[large] => http://somesite.com/wp-content/uploads/2016/03/logo.png
[large-width] => 163
[large-height] => 23
)
)
[copy] => © 2016 Wondercom.pt. Todos os Direitos Reservados
[container] => container
[default_text_color] => #58595b
[default_font_size] => 14
[default_text_line_height] => 16
[h1_repeater] => Array
(
[0] => Array
(
[text_color] => #58595b
[font_size] => 30
[line_height] => 35
)
)
[h3_repeater] => Array
(
[0] => Array
(
[text_color] => #58595b
[font_size] => 22
[line_height] => 25
)
)
[h4_repeater] => Array
(
[0] => Array
(
[text_color] => #58595b
[font_size] => 20
[line_height] => 23
)
)
[h5_repeater] => Array
(
[0] => Array
(
[text_color] => #58595b
[font_size] => 18
[line_height] => 20
)
)
[h6_repeater] => Array
(
[0] => Array
(
[text_color] => #58595b
[font_size] => 16
[line_height] => 18
)
)
[h2_repeater] => Array
(
[0] => Array
(
[text_color] => #58595b
[font_size] => 25
[line_height] => 30
)
)
[main_menu] => Array
(
[0] => Array
(
[geral] =>
[mainmenu_container] => container-fluid
[mainmenu_container_interior] => 1
[navbar_nav_right] =>
[search_bar] =>
[navbar_opt] => Array
(
[0] => Array
(
[border] => 0
[border_radius] => 0
[margin_bottom] => 0
[min_height] => 50
[border_style] => none
[border_color] => transparent
[position] => relative
)
)
[multilang_support] =>
[cores] => 1
[colors] => Array
(
[0] => Array
(
[background_color] =>
[border_color] => #ed9f4e
[navbar_collapse_form_border] => #000000
[navbar_text] => #ffffff
[navbar_link] => #ffffff
[navbar_link_hover] => #000000
[navbar_brand] => Array
(
[0] => Array
(
[color] =>
[hover_focus_color] =>
)
)
[navbar_menu] => Array
(
[0] => Array
(
[color] => #ffffff
[dropdown_menu] =>
[hover_focus_color] => #000000
[color_active] => #000000
[color_active_bg] =>
[color_open] =>
[color_open_bg] =>
)
)
[navbar_toggle] => Array
(
[0] => Array
(
[border_color] =>
[hover_focus_color] =>
[icon_bar_bacground] =>
)
)
)
)
)
)
)
Also in order to the above array show I have to do this:
while ( has_sub_field( 'main_menu', 'option' ) ):
endwhile;
$settings = get_fields( 'options' );
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.