Skip to content

Instantly share code, notes, and snippets.

View sfgarza's full-sized avatar
🏠
Working from home

Santiago Garza sfgarza

🏠
Working from home
View GitHub Profile
@sfgarza
sfgarza / ajax_class.php
Created March 15, 2016 23:04
Boilerplate code for making AJAX calls to wordpress.
<?php
if (!defined('ABSPATH')) {
exit;
}
class ajax_class
{
public function __construct()
{
//Hook = 'wp_ajax_{$action}' where $action must equal the AJAX request's 'action' property.