DEV Community

Discussion on: WP Snippet #012 Add custom (ACF) fields to the WP Rest Api.

Collapse
 
tylerlwsmith profile image
Tyler Smith

I love the REST API. I wish it were as easy to extend the actual post object as the REST response.

Collapse
 
vanaf1979 profile image
Stephan Nijman

True. Did you know you can at least get post meta fields directly from the WP_Post objects? dev.to/vanaf1979/wordpress-access-...

Collapse
 
tylerlwsmith profile image
Tyler Smith

I do, actually! It's not my favorite though: if you use ACF, it's usually doing some magic and formatting under the hood. I also use long prefixes.

I did one site where I where I managed to pull Blade templates out of Laravel, put an object wrapper around the WP_Query class and have it return custom extendable objects that wrapped the WP_Post class. It felt a little like Laravel.

It ended up being a nice experience, but I only used it once because I stopped doing much WordPress development around that time. I should really make that a starter theme and open source it...

Thread Thread
 
vanaf1979 profile image
Stephan Nijman

That sounds nice. I would love to have a look at that! :)