回答:
「より安全でクリーンな」方法は、ワードプレスとwp_ajaxフックに付属するadmin-ajax.phpを使用してプラグインファイルから処理関数を呼び出し、wp-nonceを使用して呼び出しの整合性をチェックすることです。
例えば:
あなたのajax JQueryコールは
<script type="text/javascript" >
jQuery(document).ready(function($) {
    var data = {
        action: 'ACTION_NAME',
            Whatever: '1234',
            _ajax_nonce: '<?php echo wp_create_nonce( 'my_ajax_nonce' ); ?>'
    };
    // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
    // If you need it on a public facing page, uncomment the following line:
    // var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
    jQuery.post(ajaxurl, data, function(response) {
        alert('Got this from the server: ' + response);
    });
});
</script>次に、プラグインファイルに追加します
//if you want only logged in users to access this function use this hook
add_action('wp_ajax_ACTION_NAME', 'my_AJAX_processing_function');
//if you want none logged in users to access this function use this hook
add_action('wp_ajax_nopriv_ACTION_NAME', 'my_AJAX_processing_function');*ログインしているユーザーとゲストがajaxであなたの機能にアクセスしたい場合は、両方のフックを追加します。 * ACTION_NAMEは、ajax POSTのアクション値と一致する必要があります。
あなたの関数では、リクエストが有効なソースから来たことを確認してください
function my_AJAX_processing_function(){
   check_ajax_referer('my_ajax_nonce');
   //do stuff here...
}お役に立てれば