Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option Values Not Appearing #184

Closed
erwstout opened this issue Oct 20, 2017 · 4 comments

Comments

@erwstout
Copy link

commented Oct 20, 2017

Perhaps I am doing something wrong, but when trying to view option page field values, the response returned is empty.

WP Version: 4.8.2
acf-to-rest-api version: 3.1.0
ACF Pro Version: 5.6.3

I have an ACF Options page called "Sitewide Options" and it appears the ID is 148. When I use this ID to try get the fields using http://mysite.dev/wp-json/acf/v3/options/148 it just returns a blank acf: [] array.

Any thoughts? Am I using the wrong ID?

@airesvsg

This comment has been minimized.

Copy link
Owner

commented Oct 20, 2017

Hello @erwstout,

If you use that snippet:

acf_add_options_page();

The endpoint is:
http://mysite.dev/wp-json/acf/v3/options/options

But if you register this way:

acf_add_options_page( array(
	'page_title' => 'Theme General Settings',
	'menu_title' => 'Theme Settings',
	'menu_slug'  => 'theme-general-settings',
	'capability' => 'edit_posts',
	'redirect'   => false,
	'post_id'    => 'theme-general-settings'
) );

Your endpoint is:
http://mysite.dev/wp-json/acf/v3/options/{post_id}

acf_add_options_page( array(
	...
	'post_id' => 'theme-general-settings'
	...
) );

The result is:
http://mysite.dev/wp-json/acf/v3/options/theme-general-settings

Thanks

@airesvsg airesvsg closed this Oct 20, 2017
@erwstout

This comment has been minimized.

Copy link
Author

commented Oct 20, 2017

Awesome, that helped. Thank you @airesvsg

@petercrimson

This comment has been minimized.

Copy link

commented Apr 15, 2018

Hello and thank you for this great plugin.

Here is my issue:
/wp-json/acf/v3/options/theme-general-settings
example does not work for me. It returns an empty array
/wp-json/acf/v3/options/theme-general-settings/field_name
returns the field value

Do I miss anything?
Thank you

WP Version: 4.9.5
acf-to-rest-api version: 3.1.0
ACF Pro Version: 5.6.9

@evvvritt

This comment has been minimized.

Copy link

commented Aug 16, 2018

Hi @airesvsg , I'm also getting an empty array.

  1. add_acf_options_page() with post_id set to "intranet-options"
  2. "Show in REST API" set to true
  3. GET request to /wp-json/acf/v3/options/intranet-options returns empty array
  4. GET request to .../{field_name} returns empty array

ACF Field JSON (Gist)
WP Version: 4.9.8
acf-to-rest-api: 3.1.0
ACF Pro Version: 5.7.2

Any other insights? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.