_sNonceKey, // the nonce key passed to the `wp_create_nonce()` - `add-post` is done by WordPress 'aal_nonce' // the $_REQUEST key storing the nonce. ); $_bSuccess = true; $_asMessage = ''; try { $_iUserID = get_current_user_id(); if ( ! $_iUserID ) { throw new Exception( __( 'Could not get a user ID.', 'feed-zapper' ) ); } $_asMessage = $this->_getResponse( $_POST ); } catch ( Exception $_oException ) { $_bSuccess = false; $_asMessage = $_oException->getMessage(); } exit( json_encode( array( 'success' => $_bSuccess, // the front-end js script parse these and remove from the session array from the key one by one 'result' => $_asMessage, ) ) ); } /** * Override this method to return a response. * @return array|string */ protected function _getResponse( array $aPost ) { return array(); } }