I have created custom fields to display in WordPress rest api. I want the same data to be fetched into a custom route api. How it is possible?

That is, I have some custom rest fields in the path example.com/wp-json/wp/v2/posts/

have the following rest fields I need to show in the another route. ie at example.com/wp-json/mycustom/route/v2

How can I do it?

Read more here: Access WP custom REST Fields in custom route


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: