In rest api 2.0 it is possible to get some meta fields but not others?

So – I’m using register_post_meta() to register the meta field for my custom post type so it shows the original url in the rest call with wp-json/wp/v2/my_custom_post_type_rest_handle. My next step is to add a second meta field. The thing is that I don’t need both fields in all cases. In one case I want to get a set of posts with the data in the first meta field. In the second case I want to get a set of posts (same set) but with data in another meta field.

I’m wondering about the performance overhead of getting the data I don’t need and then returning it. Of course the actual hit can be significantly less. It probably won’t really lead to more database queries. In this case the answer is probably – that this behavior is not supported and doesn’t matter.

If anyone has any insight on this it would be most welcome.

Leave a Comment