Answer the question
In order to leave comments, you need to log in
500 error when connecting ajax php file?
I want to hide a piece of the page from search engines through ajax.
I include .php file
$.ajax({
url: "/some.php",
type: "post",
dataType: "json",
data: {
"btn": btn,
"back": back,
"title": title,
"cell": cell
},
success: function(data){
console.log( "Прибыли данные: " + data.result );
}
});
wp_get_nav_menu_items()
get_the_title()
get_post_meta()
Answer the question
In order to leave comments, you need to log in
Add a line to the beginning of the file and it should work
. If you want to figure it out, you can read it here and look inside the file "/wp-admin/admin-ajax.php"
Does some.php file work directly and not via wordpress? If so, then the WP functions are not connected and, accordingly, when you try to find them, everything falls. Fix: Either serve the content you want using WP, or go on a long journey of building all the include files to include them in the script itself.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question