You can move the code from OP’s answer into a 404 template filter and force WP to load the date.php
file instead of 404.php
. It’ll still send the 404 header, but render the page with a different template.
function wpd_date_404_template( $template="" ){
global $wp_query;
if( isset($wp_query->query['year'])
|| isset($wp_query->query['monthnum'])
|| isset($wp_query->query['day']) ){
$template = locate_template( 'date.php', false );
}
return $template;
}
add_filter( '404_template', 'wpd_date_404_template' );
Related Posts:
- WordPress Posts By Date/Day?
- Archive filtering posts by year and month
- How to get the date dynamically from archive.php to date.php?
- Making next_posts_link(); return posts by month
- How can I change the way dates shown in the archive widget?
- how do I get the date in a date archive page
- What’s wrong with my date_query?
- Displaying Archives List
- Some archive by year page return 404
- How to filter by date & a specific custom post type post-WP 4.4?
- Date Archive pages 404 error
- Show all 12 months regardless they have posts
- How to disable date archives?
- date.php shows only three posts’ title. how to fix it?
- How to hide the year in archive link
- Is each issue of a magazine site a static page
- Sort results by name & asc order on Archive.php
- Custom Post Type Archives by Year & Month?
- Default archive URL wordpress
- Increase number of posts in archive page
- Custom post type pagination 404 fix?
- How do I remove unwanted pages like archive, search, etc.?
- Get list of years when posts have been published
- How can I lock down an old wordpress install I don’t intend to update?
- 404 Error On Category and Tags Pages
- How do I place content on archive pages but not on main page?
- Pagination throws 404 error on custom taxonomy archive pages
- Prevent 404 when using pre_get_posts to filter an archive page
- How can I get the Month Name from Archive?
- is_archive() returns false on the archives page
- What is archive.php used for?
- Archive by Year
- Archive widget – limit number of months to 12
- How do I visit archive-post.php?
- How do I make wp_get_archives show me months where only pages were created?
- WordPress custom post type category pagination 404 Error
- Sort custom-posts in archive.php via meta-key?
- Including post_type = ‘wiki’ in author archives
- How to pass posts_per_page and paged params query vars to custom taxonomy archive urls?
- Archive listing of posts by publish year (multiple years)
- Removing CPT slug from URL results in 404 error for archive page
- Output yearly archive within a page
- Create a month by month archive of pages (not posts)
- How to show specific year archive into dropdown list
- How to make a custom Archive Page
- Count posts for each year
- display archive as collapsing links
- How can I get the ID for an archive page? [closed]
- if in_category on archive.php
- Archive in sidebar with dropdown list of Year – Month – Day
- Arrange and separate posts
- How can I organize/create an archive listing by Year and month
- Change behavior depending on content length
- Customize first page of category
- How to edit archive page’s content inside wordpress dashboard?
- Cache previous versions of website?
- Archive pages for posts based on their taxonomy?
- front end publishing not working on front-end page
- How to show static placeholder when less post elements in archive page?
- How can I get archives for specific category without category_base in the url?
- condition for only if is archive for default post type
- Show only post titles in archives?
- Remove author archive
- Preview Post/Custom Post types in Archive
- if there is only one post in the category, directly open
- How to hide a post from archives
- How to disable monthly archive
- Displaying year, month and day archives differently
- How we display Archives for specific categories
- Date archive permalinks for custom taxonomy
- When i try to open archive pages i get a 404 error
- WordPress subcategories return 404 in custom template
- How to Create Custom Archive page
- Does only custom post type have post type archive pages?
- Modify text after post count
- How to show year/month archive including months with no posts
- Changing the post date without causing 404 error
- Archive links don’t work when clicked
- Custom archives function
- Page is displaying blog archives
- terms_description and admin problem
- wp_get_archives() display months even if there is no posts
- how do I encode links to specific archive searches?
- Group Posts by Category in Monthly Archive
- Loop through years and months in WordPress archives
- Dropdown to select posts by month and then displaying those posts in the archive page
- If one taxonomy contains the same term as another then display post
- Author archive doesn’t work [closed]
- Having a problem with Next and Previous Links
- Custom post type archive page thinks I’m not logged in
- How to conditionally check for author archive when is_author() fails to work because the author has no posts
- Custom post type / taxonomy rewrite archive page 2 gives 404
- Is there a better way to do headings for (all) archives?
- ‘Archive’ folder for posts and pages
- Post preview gives 404 when permalinks are purely date based
- Checking if a specific date archive is being displayed
- Constructing An if Statement with is_category(); in archive.php
- Filter post by clickable year [duplicate]
- next and previous year month and day for archive page
- Wrap the “show_post_count” between div