Last active
April 22, 2018 19:49
-
-
Save hawkidoki/825b5b5951d83b5c8eeacd71e14f255f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// File: ajax.php (Root WP Install) | |
// Init | |
// ----------------------------------------------------------------------- | |
define('DOING_AJAX', true); | |
define('SHORTINIT', true); | |
// WP Load | |
// ----------------------------------------------------------------------- | |
require('wp-load.php'); | |
$ajax_actions = '/includes/ajax-actions.php'; | |
// Ajax Check | |
// ----------------------------------------------------------------------- | |
@header('X-Robots-Tag: noindex'); | |
send_nosniff_header(); | |
nocache_headers(); | |
if(empty($_REQUEST['action'])) | |
wp_die('0', 400); | |
// Ajax Requirements & Actions | |
// ----------------------------------------------------------------------- | |
require(ABSPATH . WPINC . '/theme.php'); | |
require(get_stylesheet_directory() . $ajax_actions); | |
// Ajax Apply Hooks | |
// ----------------------------------------------------------------------- | |
if(!has_action('wp_ajax_' . $_REQUEST['action'])) | |
wp_die('0', 400); | |
do_action('wp_ajax_' . $_REQUEST['action']); | |
wp_die('0'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment