/** * The main handler for the specfied handle. * * @param string $handle The instance handle. * * @return Handler */ public function handle($handle) { // Sanitize the handle name. $this->handle = $this->utility->sanitize_handle($handle); // Register this handle with the frontend class. $this->frontend->register_handle($this->handle); // Register the Ajax handler in the WordPress hook system. add_action('wp_ajax_' . $this->handle, array($this, 'ajax_handler')); add_action('wp_ajax_nopriv_' . $this->handle, array($this, 'ajax_handler')); return $this; }