WP-API / docs-v2

Documentation for version 2 of the API
http://v2.wp-api.org
58 stars 76 forks source link

FAQ list #170

Closed kadamwhite closed 7 years ago

kadamwhite commented 7 years ago

Going to populate this issue with recent support questions from the WP-API github issues, then make a FAQ page for developers working with the API based on them.

kadamwhite commented 7 years ago

Disabled no longer relevant for 4.7! Authenticated-only API access covered in https://developer.wordpress.org/rest-api/using-the-rest-api/frequently-asked-questions/ -- #174 should be covered in developer guidelines.

BE-Webdesign commented 7 years ago

In the FAQ page we should change the rest_do_request() code sample to add a line for setting a param. This I am sure will save a lot of people's time having to lookup how to set parameters for their internal requests.

Something like this:

$request = new WP_REST_Request( 'GET', '/wp/v2/posts' );
$request->set_param( 'per_page', 20 );
$response = rest_do_request( $request );
BE-Webdesign commented 7 years ago

I would also change:

It is not comprehensive, so if your question is not explained here it may have been answered in the WordPress support forums.

To:

If your question is not explained here it may have been answered in the WordPress support forums.

BE-Webdesign commented 7 years ago

Another question I saw asked alot came up around Apache ripping out the Authorization header on CGI environments. The solution is to add:

<IfModule mod_setenvif>
  SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
</IfModule>

To a configuration file or .htaccess for Apache.

kadamwhite commented 7 years ago

Moved those to the FAQ page, thanks @BE-Webdesign. Let's make a new issue for future FAQ additions.