Services tab add_filter('aam_service_list_filter', function ($services) { $services[] = array( 'title' => __('URI Access', AAM_KEY), 'description' => __('Manage direct access to the website URIs for any role or individual user. Define either explicit URI or wildcard (with Plus Package addon) as well as how to manage user request (allow, deny, redirect, etc.).', AAM_KEY), 'setting' => self::FEATURE_FLAG ); return $services; }, 20); } if (AAM_Core_Config::get(self::FEATURE_FLAG, true)) { $this->initializeHooks(); } } /** * Initialize URI hooks * * @return void * * @access protected * @version 6.0.0 */ protected function initializeHooks() { add_action('init', array($this, 'authorizeUri')); } /** * Authorize access to current URI * * @return boolean * * @since 6.1.0 The method return boolean `true` if no matches found * @since 6.0.0 Initial implementation of the method * * @access public * @version 6.1.0 */ public function authorizeUri() { $uri = wp_parse_url($this->getFromServer('REQUEST_URI')); $object = AAM::getUser()->getObject(AAM_Core_Object_Uri::OBJECT_TYPE); $params = array(); if (isset($uri['query'])) { parse_str($uri['query'], $params); } if ($match = $object->findMatch($uri['path'], $params)) { if ($match['type'] !== 'allow') { AAM_Core_Redirect::execute( $match['type'], array( $match['type'] => $match['action'], 'code' => (!empty($match['code']) ? $match['code'] : 307) ), true ); } } return true; } } if (defined('AAM_KEY')) { AAM_Service_Uri::bootstrap(); }