Is there any way by which I can insert/update the data of acf fields by help of v2 api.
Thank You
]]>This happens under the following conditions:
– there are more than one relationship fields on the same page
– the same post is used as a value for two or more of these fields
– the relationship field is set to return the post object
Expected behaviour:
ACFs are added to every instance of the post object in the API response
Current behaviour:
ACFs are only added to the first instance of the post object in the API response
Origin of the issue:
In the ‘setFields’ function, when ACFs are added to a post object, the post ID is saved in the ‘fieldIDStack’ property. When the same post object is encountered again, it is ignored as its ID is already on the ‘fieldIDStack property.
Suggested solution:
Instead of only saving the ID of post object in ‘fieldIDStack’, I would suggest to save the ACF data as well. When a post object is encountered a second time, the already saved ACF data can be added to the object instead of the post object being skipped altogether.
Was working fine with the wp rest api v2 beta 15 plugin installed in wp 4.6.1, but with the 4.7 update and deactivating the wp api v2 plugin breaks all api calls.
]]>acf-to-wp-api 1.3.3 introduced a check for the REST_API_VERSION constant.
The WordPress 4.5 defines the constant as 2.0 in wp-includes/rest-api.php. The constant is defined whether or not the v2 API endpoints are used.
This is a plugin-breaking problem for legacy sites running the 1.x.x API version using the json-rest-api plugin. The /wp-json/options/ endpoint can no longer be reached after updating both WP and acf-to-wp-api.
I recognize that the v1 API plugin is deprecated and no longer maintained, even more so now that core is incorporating the v2 API directly. The long term solution is certainly to update the theme to use v2 API endpoints. That said, for stable legacy sites this situation undermines our long running advice to always update WP core & plugins because authors take pains to preserve backwards compatibility.
]]>I have no problem retrieving field values with a get request, but I can’t write the fields when creating a post.
An example array of post data sent:
$post = array(
“title” => “post title”,
“type” => “my-cpt”,
“status” => “publish”,
“excerpt” => “post excerpt”,
‘acf’ => array(
“my_field” => “my value”
)
);
The post and all fields are created except for the ACF fields. What am I doing incorrectly?
]]>Version 2.0-beta12 of the WordPress REST API plugin breaks some features of this plugin. Issues could be fixed by doing following changes:
1. Replace register_api_field function with register_rest_field -function
2. Replace ‘term’ parameter with ‘category’ in addACFDataTermV2 function.
From the WordPress REST API changelog:
* BREAKING CHANGE: Uses discrete schema title for categories and tags.
If you’ve used register_rest_field( 'term' )
, you’ll need to change 'term'
to 'tag'
and/or 'category'
.
* BREAKING CHANGE: Rename register_api_field()
to register_rest_field()
.
This plugin is really great, but it’s suddenly stopped pulling int he field for me into my wp-api url, is there a reason why this could happen?
]]>Hi there,
I have installed the plugin and refreshed the wp-api json feed a million times but the acf field doesn’t show up at all now. It doesn’t even say acf: “”. There is no acf in the api whatsoever.
It works fine locally but when I install it on the live site it don’t work. Is there anything I need to do after installing the plugin?
Many thanks
Jeff
]]>Hello,
I’m using a post object on an options ACF post and it is not returning any of the associated ACF fields.
Thanks!
Beth
]]>Hey there,
I’ve noticed that for my custom post taxonomies that are using archives, when I view them in wp-json, the acf key is mapped to false (acf: false), however when I associate ACF fields to a regular post, they show up fine.
Is there something I’m missing on my other archive post types that aren’t supported or something else I need to have enabled in order for the acf field to be populated correctly?
]]>I have been trying for some time now to get this plugin to work as expected. I tried going through github isue #13 to no avail.
I want to be able to filter the results i am given by an acf field.
I have tried just searching it like so, which seems to do the trick, but is less than ideal and fairly unreliable.
$json = wp_remote_get( site_url() .'/wp-json/wp/v2/posts?filter[s]=2010' );
When I try to filter it by doing the I following, I am given the standard last 10 posts:
$json = wp_remote_get( site_url() .'/wp-json/wp/v2/posts?filter[meta_key]=year&filter[meta_value]=2010' );
It’s ok with post, pages and attachments.
But for CPT shows only “acf: false”.
]]>Hi,
How do I output an acf field in the html file?
example: {{post.title}} works, but {{post.fieldname}} doesnt.
]]>I have acf-options addon installed.
How would I fetch that data?