Cyrillic characters in rewrite rules cause 404 Not Found errors

I ended up following @Kolya Korobochkin advice and added uppercase and lowercase versions of the rewrite rules that include escaped octets. $regular_page_uri = get_page_uri( $page->ID ); $uppercase_page_uri = preg_replace_callback( ‘/%[0-9a-zA-Z]{2}/’, create_function( ‘$x’, ‘return strtoupper( $x[0] );’ ), $regular_page_uri ); The Percent Encode Capital Letter plugin uses a similar approach to convert the octets in every … Read more

Taxonomy rewrite question

Your permalink structure for taxonomy will conflict with default one for pages. In the case of the address domain.com/item-one/item-two how does WordPress know if it’s a page item-two with the parent page item-one or item-two is custom post type and item-one is term of region taxonomy? The order of rewrite rules will decide, and because … Read more

How do you permanently remove default rewrite rules from the wp_options table?

Rather than modifying stored rules it would be more reliable to modify rules before they are stored. flush_rewrite_rules() calls WP_Rewrite->flush_rules() WP_Rewrite->wp_rewrite_rules() WP_Rewrite->rewrite_rules() Inside last there are fitting hooks to modify rules (after which result they will be saved as usual on each flush): do_action_ref_array(‘generate_rewrite_rules’, array(&$this)); $this->rules = apply_filters(‘rewrite_rules_array’, $this->rules);

Permalink rewrite with custom post type and custom taxonomy

You have to build up the link structure by using filters post_link and post_type_link: add_filter(‘post_link’, ‘territorio_permalink’, 10, 3); add_filter(‘post_type_link’, ‘territorio_permalink’, 10, 3); function territorio_permalink($permalink, $post_id, $leavename) { if (strpos($permalink, ‘%territorio%’) === FALSE) return $permalink; // Get post $post = get_post($post_id); if (!$post) return $permalink; // Get taxonomy terms $terms = wp_get_object_terms($post->ID, ‘territorio’,’orderby=term_order’); if (!is_wp_error($terms) && … Read more