I am creating a plugin to send posts to an external program. But I get a problem by getting the posts.
I created the code below to get the posts and echo them. But if I run it, it goes to the empty error message. When I echo the response. It only gets ‘Array’
If I just post
http://localhost/wordpress/wp-json/wp/v2/posts in a browser, I get a JSON with my posts
What am I doing wrong?