Regionalised Content

I think you can create a rewrite rule for each “region” to don’t overwrite other important rules you could need (like pages, categories, etc..). I was playing with your code examples and with a small change in rewrite_resets could work: public function rewrite_resets() { global $wp_rewrite; foreach($this->ENABLED_POST_TYPES as $post_type) { $args = get_post_type_object($post_type); switch($post_type) { … Read more

Custom Permalink Tag breaks Pagination

Thanks to Milo’s help the code in the question ended up working: permalinks fixed and the structure stayed exactly how I wanted it described in the question above. Removed the rewrite_rules_array hook entirely Moved my taxonomy registration above my post type registration Changed the taxonomy to be non-hierarchical ‘hierarchical’ => false From my limited understand … Read more

Rewrite URL Parameter And Force ‘Pretty’ Permalink

You could force the redirect this way by checking for the get_var query value: add_action(‘init’,’my_redirect_check’); function my_redirect_check() { if (isset($_GET[‘my_var’])) { if ($_GET[‘my_var’] != ”) { if ($_SERVER[“HTTPS”]) {$location = ‘https://’;} else {$location = ‘http://’;} $location .= $_SERVER[‘SERVER_NAME’]; $location .= strtok($_SERVER[‘REQUEST_URI’],’?’); $location = trailingslashit($location); $location .= $_GET[‘my_var’]; $location = trailingslashit($location); wp_redirect($location); exit; } } } … Read more