In functions.php
function productsPageRedirect_404() {
global $post;
if( is_page('products') ) {
global $wp_query;
$wp_query->set_404();
status_header(404);
}
}
add_action( 'wp', 'productsPageRedirect_404' );
Related Posts:
- Page returns 404 with POST variables, but not without
- Where does the 404 redirection happen?
- Putting footer content in a “page” – Doing it wrong?
- Page not found error when adding text `2 = 2 ^ 1` to the page
- Created php page in wordpress – Error Page can not be reached
- Missing Page, But Still Exists In Preview
- WordPress Site Page Exists but Error 404
- How to bypass 404 for certain pages/posts?
- Loading ACF Field content on a 404.php page
- Pages in wp-admin is not found 404
- Assign Parent Page – Now 404 Error
- Add pagination to search.php page
- If searched in a category show different 404 page
- Get page id by template
- How can I keep the content of my pages version controlled?
- How to load JS and CSS only on specific Pages using is_page()?
- Listing pages which uses specific template [duplicate]
- WordPress page edit does not save selected template
- How do I set and list page_template with wpcli?
- How to get post or page excerpt using post_excerpt
- Object gets unwanted width and height
- Automatically set page order on create page
- WP is not using the select custom template.php that its selected for a page
- Is it possible to set a page template on a dynamic home page (articles list)?
- Page with page template not using template in Preview
- Subpages return 404 error [closed]
- wordpress with many custom styled static pages
- Check whether the child page has siblings
- wp_dropdown_pages default value
- User capability of create page/new page
- A function like is_page() but returns true if on any sub page of given page
- How to get the excerpt of a page before more tag?
- Using page slug in array
- Shortcode produces blank page
- Get all children page ID’s including parent by title
- How to modify the default WordPress ‘Pages’ widget to have titles on the anchor tags?
- Creating a 3-column layout on a WordPress Page
- Create page that is not deletable
- I have index.php and other files, how do I display other pages?
- is_home() returns TRUE on page template
- Location-Based Pages displaying results near customer
- Adding New Users to Your WordPress Site for edditign only one page
- Multiple alias for single page
- Removing Parent Page URL While Keeping the Navigation Intact
- Organizing Your Pages
- Custom page template for multiple pages
- IF user is logged in only show certain page
- No Appearance panel is shown
- hard coded html / php pages on local host directory don’t show up in WP dashboard
- the_content of template page
- Post Fetching Ignoring Sort_Column?
- loading a javascript on a WP PAGE
- WordPress theme: Add page content to the bottom of the Contact form
- Page access only from a specific page in wordpress website
- How to show ‘tags’ in ‘WordPress Pages’ [not Posts]
- How can I change “page” (as in foobar.com/page/5) to another word?
- determine whether content is of type Page or a Post and display accordingly
- Check if the child page has sibling pages, and bookmark current page
- pre-existing data, and entities
- Huge number of 404 pages getting spawned
- Automatically generate pages from SQL
- require_once not working
- Undefined index: post in NOTICE while adding meta box
- Set a variable to using in redirected page
- creating single page with 2 columns while theme is 3 column
- Outputting content from page
- Use an archive as the parent of a page?
- Displaying the blog entries in a Page (using get_posts to retrieve the posts)?
- products category page editing
- Different template parts when on different pages
- Updating page template pragmatically
- Why can’t pages be categorized / tagged?
- Adding in additional pages into a custom theme
- wordpress page navigation numeric pagination showing same posts on each navigation
- WordPress dosn’t save page/post updates
- Sup pages can’t be found
- How to use wp_dropdown_pages or wp_list_pages to accomplish a menu like this?
- Get child pages in get_pages function
- WordPress Page All Content In Template Good Or Bad Convention?
- Displaying Content Only in Certain Page IDs Not Working
- WordPress white screen with “All Pages”
- How to Change the path of a child page?
- Annoying notification when trying to create a new page
- Page stuttering on load
- How To List Sibling Pages And Include The Featured Image?
- WP Template Hierarchy – Need help choosing the correct templates
- the_content() Returns post content when I want page content
- disable trashability for certain pages
- how bbPress and buddypress add their own page templates to the page template drop down on the page editing screen
- Can’t select a page using is_page()
- pages won’t show on front page using loop or pre_get_posts
- Does WordPress list all pages for crawlers?
- List of pages – AJAX load more
- one time visit to the page
- How to display child page from specific parent page in homepage?
- How to display text of a page in home or custom page?
- Cannot Create a new Post [closed]
- User profile in front-end
- custom css in one page
- Why is a page shown with ‘hidden’ next to the name in the list of pages if the page is set to public?