Setup proper 301 redirect for deleted tags

Sounds like an easy task to do. I think hooking into ‘template_redirect’ and conditionally triggering redirect is the way to go. EDIT: Seems is_tag() isn’t reliable once 404 is triggered. That’s why we need to look into the query vars to figure out if it’s really a tag query or not. function redirect_404_tags_wpse67077() { global … Read more

using wp_redirect to redirect to a permalink

Because it is looking for the page 404, which is a child of the page /error. Try just doing this: function show_404($message=”page not found”){ wp_redirect(home_url() . ‘/error?m=’ . urlencode($message)); exit(); } But your doing it wrong. You should just use WordPress’s internal 404 page, it will save a lot more headaches that will arise in … Read more

Author page points to 404 error page

The user_nicename should never have spaces. It is a sanitized version of user_name, that has been sanitized (Aa-Zz,0-9,_,-) to be suitable for use as a slug. If you have spaces in your user_nicename values, you’re going to get 404 errors. To correct, you’ll probably need to edit the database directly. Here are instructions, with screenshots, … Read more

Pagination breaks on child-categories, works fine on parent-category

I was finally able to get this working! Here’s how: What I had misunderstood (being a WP noob and all…) is that get_query_var(‘page’) is for pages, and get_query_var(‘paged’) is for posts. http://codex.wordpress.org/Function_Reference/get_query_varfor So I replaced these two lines $paged = (get_query_var(‘page’)) ? get_query_var(‘page’) : 1; // FOR PAGINATION ‘page’ => $paged, // FOR PAGINATION with … Read more

Error 404 on pagination on homepage

To understand why 404 erros occur with pagination, you have to first understand the process WordPress follows when a page is requested. The query is parsed and the results are queried from the database before the template is loaded. When you create a new query in the template, these results are unrelated to the original … Read more

How to bypass 404 for certain pages/posts?

When you add a custom post type, WordPress doesn’t know that it needs to regenerate it’s permalinks/rewrite rules. Visit the permalinks settings page to flush and regenerate the links and your custom post type permalinks will start to work, else you’ll get 404 messages. A word of warning: Some people will advise you call flush_rewrite_rules … Read more