I'd like to disable the default WP query vars (p, attachment_id, etc...), and make the pages only accessible by URI Permalinks.
I've taken a list of variables from WordPress Query Vars and created a small function to disable them, but it's probably not "the way" since it gives weird results (most of the pages aren't properly routed).
Thank you!
function disable_query_vars($vars)
{
if (!is_admin())
{
$disable = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage', 'post_type');
foreach ($disable as $var)
unset($vars[$var]);
}
return $vars;
}
add_filter('request', 'disable_query_vars');