Categories and Tags returning 404 on the sidebar when using ugly permalinks

Instead of: home_url() . “/tag/” . $i->slug Use get_term_link() function. It will return the link for the term according with the current configuration: // Assuming $i is a term object get_term_link( $i->term_id ) For example, your printTags() function would be: function printTags($tags){ //Check to see if tags are provided if ($tags!=false) { $return = ”; … Read more

Change in custom taxonomy permalink causes 404 error for another custom taxonomy

After many efforts I have solved it, but it’s not completely what I want, as I had to compromise on one thing and passed some separators in the URL. Example: example.com/separator1/parentatx/childtax/separator2/postname/ In order to avoid 404 errors, in case of pagination and another custom taxonomy, I created some rewrite rules. Here is my code: First … Read more

How to change the permalink structure of a master page?

To remove pagination prefix page in home page you should: add a rewrite rule which will translate the new link format, prevent redirection to address containing page, replace URLs in paging links. By creating pagination links, WordPress appends query var paged with mentioned prefix to url. Therefore, without modification, the links would look like example.com/3/page/3. … Read more

Change permalink only on new posts

Your permalink structure is global; it is not a property of individual posts. There is no way to indicate that one post uses a certain permalink structure while another uses a different one. This makes sense when you think about how WordPress processes requests. Using the new structure, WordPress maps the request to index.php?name=$1 where … Read more

add_rewrite_rule with bottom priority doesn’t handle the WordPress pages

When you point a rule to anything other than index.php, it gets interpreted as external and written to the .htaccess file. After external rules are parsed, requests get directed to WordPress, which parses the internal rules in php. This is the internal version: function custom_rewrite() { add_rewrite_rule( ‘^(bar|baz|foo-.*)’, ‘index.php?my_var=$matches[1]’, ‘top’ ); } add_action( ‘init’, ‘custom_rewrite’ … Read more