I am creating a single page WordPress site and I would like disable/delete/remove all other pages so that they just return a 404.
So if the user tries to go to an archive page or a single post page it does not work. I only want one working page on the entire site.
You can simply force all pages to be redirected to the front page by putting the following code in your functions.php:
Just a quick note:
is_front_page()
checks if the user is trying to access the page that is set for the front page in Settings > Reading. If no such page is set, useis_home()
instead.Reference:
http://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect
http://codex.wordpress.org/Function_Reference/is_front_page
http://codex.wordpress.org/Function_Reference/is_home
Instructions for what I think you want to have done. This will remove all other pages/posts, and make the page you did not delete into the home page of your website.