wordpress - WP-JSON API request doesn't accept query parameters -


I'm really using great WP-API () to retrieve posts from my site. It works perfectly on my local dev environment (Apache) and Apache server but with nginx it does not have on my future production server.

This query provides the only test post, which is the correct behavior, but the questions below will not work, all the query parameters are ignored and this is the same result Lets back up The expected behavior is that it gives examples of 'About' and 'Contact' pages to the page.

You can see the right query results here:

As I said the difference is only the webserver here my nginx config The file is my nginx version nginx / 1.1.19

  server {# .domain.com domain.com and anything.domain.com from server_name 2013.thomastraum Will match. com; # Root server at the server level is best for routing, and location level # Any location block path will be relative to this root. Root /var/www/2013.thomastraum.com; It's always good to set up # logs, but you can not close the error log # setting error_log; Just 'Close' will create a file called Access_log /var/log/nginx/2013.thomastraum.com.log; Error_log /var/log/nginx/2013.thomastraum.com.error.log; # This http {} level index can also go to index.html index.htm index.php; Location / {# if you are just using WordPress and do not want additional reallies, replace wordrewrews with # windows.php # try_files / $$ / index.php; Try_files $ uri $ uri / /index.php?q=$request_uri; } Location @rewrites {# can put some of your rewriting rules here for example, rewrite the example ^ / ~ (. *) / (. *) /? / User / $ 1 / $ 2 final; # If no one matches, then we will re-write /index.php/ last.ind.in.php; } # This block contains static file requests, such as images, CSS, JS # the ?: prefix is ​​a 'non-capturing' sign, which means that we do not need the pattern captured in # $ 1, Need help in improving ~ *. (?: Ico | css | js | gif | jpe? G | png) $ {# Fixed some basic cache-control maximum for static files sent in the browser; Add_header Pragma public; Add_header cache-control "public, re-modify, proxy-modify"; } # If you have WordPress' virtual robots.txt location = /robots.txt {access_log off; Remove the robot line if you want to use it; Log_not_found off; } Location = /favicon.ico {access_log off; Log_not_found off; } # Hidden files on this place (starting with period) ~ / \ {Access_log off; Log_not_found off; Deny everyone; } Location ~ \ .php {fastcgi_param QUERY_STRING $ query_string; Fastcgi_param REQUEST_METHOD $ request_method; Fastcgi_param CONTENT_TYPE $ content_type; Fastcgi_param CONTENT_LENGTH $ content_length; Fastcgi_param SCRIPT_NAME $ fastcgi_script_name; Fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name; Fastcgi_param REQUEST_URI $ request_uri; Fastcgi_param DOCUMENT_URI $ document_uri; Fastcgi_param DOCUMENT_ROOT $ document_root; Fastcgi_param SERVER_PROTOCOL $ server_protocol; Fastcgi_param GATEWAY_INTERFACE CGI / 1.1; Fastcgi_param SERVER_SOFTWARE nginx; Fastcgi_param REMOTE_ADDR $ remote_addr; Fastcgi_param REMOTE_PORT $ remote_port; Fastcgi_param SERVER_ADDR $ server_addr; Fastcgi_param SERVER_PORT $ server_port; Fastcgi_param SERVER_NAME $ server_name; Fastcgi_pass 127.0.0.1:9000; }}  

You can fix the nginx.conf configuration file or alternatively You get the parameter json_route in this fashion:

 ? Json_route = / post  

You can also do this with filters:

  •  ? Json_route = / posts? Filter [s] = some  


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -