Open arsistyle opened 4 years ago
Hi, i need get custom values from images submited in custom posts / optios pages / pages / etc. Like in media /wp-json/wp/v2/media when i call this from API, because default array don't bring the ACF values.
/wp-json/wp/v2/media
This is the default data:
{ "ID": 26, "id": 26, "title": "avatar", "filename": "avatar.jpg", "filesize": 163788, "url": "****/wp-content/uploads/2020/05/avatar.jpg", "link": "***/avatar/", "alt": "", "author": "1", "description": "", "caption": "", "name": "avatar", "status": "inherit", "uploaded_to": 0, "date": "2020-05-22 17:35:20", "modified": "2020-09-01 15:45:43", "menu_order": 0, "mime_type": "image/jpeg", "type": "image", "subtype": "jpeg", "icon": "****/wp-includes/images/media/default.png", "width": 666, "height": 666, "sizes": { "thumbnail": "****/wp-content/uploads/2020/05/avatar-150x150.jpg", "thumbnail-width": 150, "thumbnail-height": 150, "medium": "****/wp-content/uploads/2020/05/avatar-300x300.jpg", "medium-width": 300, "medium-height": 300, "medium_large": "****/wp-content/uploads/2020/05/avatar.jpg", "medium_large-width": 666, "medium_large-height": 666, "large": "****/wp-content/uploads/2020/05/avatar.jpg", "large-width": 666, "large-height": 666, "1536x1536": "****/wp-content/uploads/2020/05/avatar.jpg", "1536x1536-width": 666, "1536x1536-height": 666, "2048x2048": "****/wp-content/uploads/2020/05/avatar.jpg", "2048x2048-width": 666, "2048x2048-height": 666, "dribbble-format": "****/wp-content/uploads/2020/05/avatar-666x600.jpg", "dribbble-format-width": 666, "dribbble-format-height": 600, "banner-pattern": "****/wp-content/uploads/2020/05/avatar-250x250.jpg", "banner-pattern-width": 250, "banner-pattern-height": 250 } }
I need something like this
{ "ID": 26, ... "acf": { CUSTOM_VALUE1: 123 CUSTOM_VALUE2: 123 } }
how i do this in functions.php for options sub page and others or do this by default for all attachment custom values??
Thanks for help :)
Hi, i need get custom values from images submited in custom posts / optios pages / pages / etc. Like in media
/wp-json/wp/v2/media
when i call this from API, because default array don't bring the ACF values.This is the default data:
I need something like this
how i do this in functions.php for options sub page and others or do this by default for all attachment custom values??
Thanks for help :)