我正在使用Modern Tribe的“The Events Calendar”插件。我在一个加载了ajax get语句的php文件的开头有以下代码。
if (!function_exists('tribe_create_event')) {
echo "function does not exist";
return;
}
这是ajax电话。
jQuery.get("http://allthingsbahai.net/wp-content/themes/accelerate-child/insertdate.php",
{gregdate: gregdate, badidate: badidate},
function(result, status) {
alert(status);
alert(result);
//alert(result.badidate);
//alert(result.gregdate);
}
);
返回成功状态,结果“功能不存在”。我对这一点感到困惑。日历工作正常,通过wordpress管理界面接受条目,并正确显示。 我很难过。
答案 0 :(得分:0)
您直接呼叫文件http://allthingsbahai.net/wp-content/themes/accelerate-child/insertdate.php
。此文件可能无法加载其他文件。 WP和其他插件通过以下代码中止对文件的直接调用。
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
您可以通过使用操作来遵循AJAX的WP方式,转到Codex了解更多详情。 https://codex.wordpress.org/AJAX_in_Plugins