Timeline for How to rewrite AJAX call URL to admin-ajax.php to match REST style URLs
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 29, 2013 at 8:00 | comment | added | John | Great! Thx. This has given me the base to start. | |
Jun 28, 2013 at 13:42 | comment | added | fuxia♦ | Yes, exactly. This is the most flexible approach, because you don’t have to change the .htaccess each time you extend your parser. | |
Jun 28, 2013 at 13:31 | comment | added | John |
So you mean to say the rewrite URL pattern in htaccess would remain the same, i.e. RewriteRule ^rest/$ /wp-admin/admin-ajax.php [L] for all URLs and I must extract the value inside of the admin-ajax.php?
|
|
Jun 28, 2013 at 13:18 | comment | added | fuxia♦ |
The method get_api_values() does it: strtok( $request, '/' ); separates the values from each other.
|
|
Jun 28, 2013 at 13:17 | comment | added | John |
I took a look at the second link but could not find anything relevant to $_SERVER['REQUEST_URI'] . Am I missing something?
|
|
Jun 28, 2013 at 13:08 | comment | added | fuxia♦ |
Inspect $_SERVER['REQUEST_URI'] like in the second link.
|
|
Jun 28, 2013 at 13:06 | comment | added | John |
I did try earlier, the htaccess hack that you suggested in the answer that you linked. Though it serves the purpose of rewriting the AJAX url to a different location, I'm not sure how it could be modified to map "multiple" query parameters. Like in example above posts should refer to action=get_posts and 1 should refer to user_id=1 . And if I have an additional query parameter, let's say page then that should also map correctly.
|
|
Jun 28, 2013 at 12:41 | comment | added | fuxia♦ | Have you seen and tried this or this? | |
Jun 28, 2013 at 12:38 | history | asked | John | CC BY-SA 3.0 |