wp_query json ouput

You’re running the query but you’re immediately afterwards printing it out, you need to call the method get_posts or use something like a while statement with have_posts: https://codex.wordpress.org/Class_Reference/WP_Query

Query only title/field/featured media of posts [closed]

You can make query like this $paged = get_query_var(‘paged’) ? get_query_var(‘paged’) : 1; $args = array( ‘post_type’ => ‘post’, //Specyfying post type ‘cat’=> 1, //Selecting post category by ID to show ‘posts_per_page’ => 10, //No. of posts to show ‘paged’ => $paged //For pagination ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) … Read more

WP Rest API V2 OR Operator in URL

First (since 4.7.1) you will need to re-activate the filter parameter. Then make sure you have REST support activated for your custom post type (books). Next you have to allowing the query args meta_query and parse it. This answer shows how to do all this. Specifically, how to construct the meta query and the compare … Read more

How to do rest APi with wordpress

First of all you should re-submit permalink to enable rest api in your wordpress. your rest api url is: http://your-site.com/wp-json/ And you can register new endpoind with bellow code: add_action( ‘rest_api_init’, function () { register_rest_route( ‘myplugin/v1’, ‘/author/(?P<id>\d+)’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘my_awesome_func’, ) ); } );