airesvsg / acf-to-rest-api-recursive Goto Github PK
View Code? Open in Web Editor NEWGet ACF fields recursively
Get ACF fields recursively
Hi, thanks for writing this! I don't know why, but in plugin.php I had to change the after_theme_setup
hook to wp_loaded
to get it to work. Otherwise, it works great! Any insights on why this is?
Hi,
I can't make it work as I need and I don't understand if I do it wrong or simply it is not possible.
I have two custom post types: "menus" and "dishes";
Eash dish has a few fields, say "dish name (post title)", "dish price", "dish description";
I want to create dishes and associate them to menus via relationship field.
Example:
MENU 1
dish 2, dish 4, dish 7
MENU 2
dish 1, dish 6, dish 11
If i call menu 1 via rest with url .../wp-json/acf/v3/custom_menu/1
I get dish names (which are post titles) but can't get post acf fields.
The same happens if I call .../wp-json/wp/v2/custom_menu/8, slightly different response but no acf fields.
I tried registering post types with Custom Post Types UI, Types, via code, but none of those makes any difference.
Thank you
Hi
This plugin seems very neat but i'm having trouble find examples of what I want to achieve. Please can you point me in the right direction.
I'd like to filter all packages with a max price http://localhost/wp-json/acf/v3/packages?max_price=1001
The json is as follows
[{
"id": 1,
"acf": {
"packages": {
"title": "I am a doge",
"price": "1000",
}
}
}]
And my the code
add_filter( 'rest_query_vars', function ( $valid_vars ) {
return array_merge( $valid_vars, array( 'max_price', 'meta_query' ) );
} );
add_filter( 'rest_packages_query', function( $args, $request ) {
// missing code
);
Hello,
Is there anyway to add the featured image url of the ACF object / relationship post field ?
Thanks :)
Is it possible to go even deeper than /wp-json/acf/v3/{taxonomy}/{id}/{field-name}
?
I'm looking for /wp-json/acf/v3/{taxonomy}/{id}/{field-name}/{id}
Hi, thanks for this plugin - it's simple and super helpful.
One thing I noticed is that if an admin on a WP site using this plugin accidentally adds an ACF Relationship field to the same post that they are working with, the REST API response breaks and runs into an infinite loop situation.
Should be a similar fix I'd imagine to make sure that this is avoided. If I have time I will try to crack in and make a pull request. In the meantime I thought I'd let you know!
I set an ACF fields group for attachments and an ACF fields group with a gallery field for a custom post type.
Am I supposed to see the attachment fields for the gallery listed in the response in my cpt endpoint:
https://mysite.com/wp-json/acf/v3/mycpt
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.