テーマで ajax リクエストを実行したいと思います。
バック オフィスにログインしている場合、リクエストは行われますが、ログインしていない場合は null が返されます... 解決策を教えてください。
私からしてみれば :
$.ajax({
type: "POST",
url: 'http://www.mysite.com/wp-admin/admin-ajax.php',
data: $('#EventForm').serialize()+'&action=event_form',
success: function(response){
if(response == 1){
alert('ok');
} else {
alert('no ok');
}
});
functions.php 内 (Office にログインしている場合にのみ機能します)
add_action('wp_ajax_event_form', 'ajax_event_form');
function ajax_event_form(){
global $wpdb;
...
echo true;
die;
}