Skip to content

Instantly share code, notes, and snippets.

@anthonybudd
Last active February 27, 2017 15:31
Show Gist options
  • Save anthonybudd/46b5708ec05eb6a444141959b5d34718 to your computer and use it in GitHub Desktop.
Save anthonybudd/46b5708ec05eb6a444141959b5d34718 to your computer and use it in GitHub Desktop.
<?php
Class Example extends WP_AJAX
{
protected $action = 'example';
protected function run(){
echo $this->requestType(); // 'GET'
echo $this->requestType('GET'); // (bool) TRUE
echo $this->requestType('POST'); // (bool) FALSE
echo $this->requestType(['GET', 'PUT']); // (bool) TRUE
echo $this->requestType(['POST', 'PUT']); // (bool) FALSE
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment