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 the future. It is as simple as creating a template of 404.php in your current theme directory.
Related Posts:
- Why does enabling Permalinks make pages not found?
- After server migration only the homepage works
- Changing permalinks gives me 404 errors on nginx
- Pretty permalinks for search results with extra query var
- Including category-base in a post permalink results in 404
- WordPress thinks my custom route is a 404
- Homepage loads but all permalinks are 404 when using nginx & PHP-FPM
- 404 on category.php pagination
- Posts not working on windows after changing permalinks
- removed index.php now all pages 404
- How to identifty post from its URL in 404 page?
- Redirect old permalinks with Month and name to Post name on new site
- Does WordPress send a 301 header message when you change permalink structures?
- Permalinks Structure and 404 Question
- Attachment page 404 not found when image is attached to post
- After moving from subdirectory to home, home page does not display
- Changes to permalink structure results in 404 error for all pages other than home
- Can’t get rewrite rules working
- permalink changed, now getting 404 for every pages
- Permalinks broken regularly
- 404 Page Not Found for Only One Post
- Permalink /%category%/%postname%/ returns 404 on OSX
- Permalinks keep reverting to 404 unless I re-save them
- Clean install – Changing permalinks in twentyeleven give 404
- Permalink change made author archive vanished
- Permalinks okay some pages but 404 error on others
- AWS WordPress Install – pages/posts 404 on restart until updating permalinks
- WordPress 404 in development area
- Permalinks by page/post name returning 404
- Custom Permalink
- Editing Pages Give 404 Error After WordPress Upgrade in Admin Panel
- page nested 3 levels deep shows 404
- Changing the post date without causing 404 error
- Nginx Rewrite Rule:: index.html added to every permalink
- Moving local wordpress page to a real server subdomain broke my permalinks?
- How to make /search/ without parameters not return a 404?
- 404 Error Problems with sCategory Permalink plugin
- Why does the ‘Month and Name’ Permalink Format not Work on my new WordPress Site (running on IIS7)?
- WordPress post-name permalink redirects to site.com
- Redirect /%year%/%monthnum%/%day%/%postname% [closed]
- Edit page slug after save, cause 404 by linked pages
- Unable to get /%postname%/ permalinks working, 404 on all links
- Permalink Doesnt Work – URL Not Found
- 404 when going to /blog
- Permalinks 404 error with HTTPS host
- Permalinks stopped working – NO update, mod_rewrite enabled, .htaccess not touched
- WordPress can generate numeric permalinks, which then 404
- Custom permalink structure gives 404
- Accessing Subdirectories in WordPress Install
- Post preview gives 404 when permalinks are purely date based
- WordPress suddenly changed all links to example.com/example.com/
- Resolve 404 on posts without category
- Visiting posts results in 404 errors after host migration
- How do I change the permalink structure without getting 404s?
- 404 on internal pages, in all sites in my local server
- Home page Pagination – Other pages do not redirect to home page template
- WordPress pages and posts are redirecting to server IP address instead of domain URL [closed]
- Page redirect to 404 when set Permalink = “Post Name”
- Fix 404 error after changing permalink structure
- WordPress Permalinks 404 bug with “next” button
- Main blog page works but title says Page not found
- how to set up wp in folder within static website?
- permalink and add_rewrite_rule – error 404
- WordPress permalink change causes all incoming links to give 404 errors
- old permalinks not found
- The requested URL was not found on this server [closed]
- WP-e-commerce (getshopped) – Annoying permalink issue [closed]
- Browsing to permalink prefix results in 404
- Problem with special character WordPress
- remove SLASH on single_post but KEEP on categories and parent pages
- Xampp 7.3.3 fresh install of WordPress 404 pages unless permalink is set to plain
- WordPress /page/2 gives 404 when custom permalinks is set to %category%%postname%
- Custom structure permalink preventing 404
- Extending page urls without getting a 404
- I have a 404 error on all my pages! What do I do?
- Giving specific category posts its own permalink structure returns 404
- 404 on pretty permalinks when serving via HTTPS
- 404 error on published page with specific permalink
- 404 page not found – Yet open admin page it works
- Custom permalink gives 404 error only in some pages
- Woocommerce product page 404 not found
- Every sub page shows Error 404, i have check permalink but still same issues
- Remove Permalink of certain posts
- Problem with permalinks
- Automatisation permalinks for each making of new page
- wp_dropdown_categories links 404
- HTTPS permalinks resulting in 404
- Permalink Rewrite with Archive – Archive gets 404
- Change the permalinks structure
- When using number in url it is redircting to same page but when using character it redirects to 404
- Page_link change
- Accidentally changed the permalink structure
- Folder Name and Category Name WordPress
- Although rewrite engine is on, I get 404 not found on every page
- Only homepage working correctly, 404 error on everything else
- 404 error on second page load for child-pages
- Parent pages not found with pretty permalinks
- WordPress keep redirecting me to random URLs
- Plugins, themes and other dashboard links including permalinks giving 404 error
- WordPress Permalinks 404 Not Found