admin管理员组文章数量:1122832
I need to find bug in a Wordpress site.
But I can't find the method (function) that the AJAX GET call runs on backend.
That's not admin part of website, but front end part of website.
important
I found the url where AJAX call is sent, but don't know how to find the method/function.
code for sending AJAX call looks like this
I have code for sending XMLHttpRequest something like this:
var xhr = new XMLHttpRequest();
xhr.open("GET", ".php?action=logged_in_check");
xhr.setRequestHeader("X_REQUESTED_WITH","xmlhttprequest");
xhr.onload = function(){
console.log(xhr.responseText);
}
xhr.send();
There is nothing like add_action() on frontend.
What could you advise? Any technics, advices?
I need to find bug in a Wordpress site.
But I can't find the method (function) that the AJAX GET call runs on backend.
That's not admin part of website, but front end part of website.
important
I found the url where AJAX call is sent, but don't know how to find the method/function.
code for sending AJAX call looks like this
I have code for sending XMLHttpRequest something like this:
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://themes.qnimate.com/qplog/wp-admin/admin-ajax.php?action=logged_in_check");
xhr.setRequestHeader("X_REQUESTED_WITH","xmlhttprequest");
xhr.onload = function(){
console.log(xhr.responseText);
}
xhr.send();
There is nothing like add_action() on frontend.
What could you advise? Any technics, advices?
Share Improve this question edited Apr 14, 2017 at 8:42 Yurii Halapup asked Apr 13, 2017 at 20:57 Yurii HalapupYurii Halapup 1014 bronze badges 4- firstly use the network monitor to look which AJAX call is send, e.g. with firefox : developer.mozilla.org/en-US/docs/Tools/Network_Monitor – mmm Commented Apr 13, 2017 at 21:00
- hello, I found the url where AJAX call is sent, but don't know how to find the method/function. – Yurii Halapup Commented Apr 13, 2017 at 21:07
- then edit your question and details what you have seen, without more informations it's hard to help you – mmm Commented Apr 13, 2017 at 21:10
- Do you have access to the source code of that site? – Tom J Nowell ♦ Commented Aug 12, 2021 at 14:58
1 Answer
Reset to default 0If the url is something like this admin-ajax.php?example_ajax_request=1&data=1234
The add_action function in the code would be wp_ajax_nopriv_example_ajax_request
So, try to grep the whole of your theme directory or plugin directory for the text.
Example: grep -r 'wp_ajax_nopriv_example_ajax_request' *
The second parameter of the add_action is the function name you're looking for.
See https://codex.wordpress.org/AJAX_in_Plugins#Ajax_on_the_Viewer-Facing_Side for example of how it works.
本文标签: phpFind the method which AJAX GET calls
版权声明:本文标题:php - Find the method which AJAX GET calls 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736291873a1928814.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论