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

how to set up wp in folder within static website?

It sounds like you need to copy the file /blog/index.php to /index.php and modify a line in the new copy you create: require(‘./wp-blog-header.php’); to require(‘./wordpress/wp-blog-header.php’); Here is a complete guide to moving WordPress into a separate folder: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

If post does not exist, do something

If in your template you create a 404.php all not-found requests will be handled by this template file, and there you can put whatever you want. Just as example, in the 404.php file is possible to use something like (it’s just a draft): <?php get_header(); ?> <h3> <?php $slug = get_query_var(‘name’); if ( $slug ) … Read more

A change in URL slug in database returns 404, how can I do auto-redirect?

If you look in the database in the $wpdb->postmeta table you will see a meta_key named _wp_old_slug. That is how WordPress tracks slug changes. By editing the database directly you bypassed the mechanisms that create that postmeta entry. You never want to edit the database directly if you can use WordPress Core functions instead. Attempting … Read more

Thousands of 404 errors on old posts due to embedded links

I am about 99% sure the reason for much of this is that someone has used relative links in the post body. A link that looks like this: <a href=”www.whufc.com/”>Some link Test</a> Will end up looking like this: 2010/premiership-forecast-title-race-hots-up-gunners-prepare-for-adebayor/www.whufc.com/ If it shows up on this page of the site: 2010/premiership-forecast-title-race-hots-up-gunners-prepare-for-adebayor/ You need to have the … Read more