Created
April 6, 2019 08:32
-
-
Save obiPlabon/63beae2855583a9feaac26108d2da2d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$request = new WP_REST_Request( 'GET', '/wp/v2/posts' ); | |
$request->set_query_params( [ 'per_page' => 12 ] ); | |
$response = rest_do_request( $request ); | |
$server = rest_get_server(); | |
$data = $server->response_to_data( $response, false ); | |
$json = wp_json_encode( $data ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment