You don’t need to specify a pagename, if you want to replicate a post type archive set post_type
instead.
function add_events_rewrite_rules(){
add_rewrite_rule(
'events/date/([^/]+)/?$',
'index.php?post_type=events&_events_date=$matches[1]',
'top'
);
}
add_action( 'init', 'add_events_rewrite_rules' );
Related Posts:
- Rewrite custom post type url’s adding meta box values
- add_rewrite_endpoint() and Custom Post Type Archive
- CPT custom archive template does not get loaded
- Canonical url differs from custom post type archive URLs
- Add parent post to Custom Post Type [closed]
- Custom Post Type Date Based Archive URL rewrite [duplicate]
- Pages not appearing?
- Custom archive URL as a subfolder of the custom post type slug
- Dynamic WordPress rewrite rules for multiple custom post types
- Get custom post type slug for an archive page
- Custom Post Type Settings page, choose page to display archive
- Adding a menu item for a Custom Post Archive
- Adding custom post type archives to a WordPress menu
- Multiple post types – share same ReWrite slug?
- How do you create an archive for a custom post type from a plugin?
- Custom Post Type Archives by Date with Custom Permalink
- How to modify URL structures in custom post types and taxonomies or terms
- Change title in head on Archive page
- Modify custom post type rewrite rules in a separate function
- Change page /2 to /transcript with a Rewrite
- Custom Post Type archive as front page
- Permalink rewrite with custom post type and custom taxonomy
- Priority for Categories, Tags, Taxonomies, Posts, Pages and Custom Posts with same url
- Adding custom post types to archive.php
- wrong template for page of archive
- archive-{$post_type}.php not loading. instead the default archive.php loads
- How to make an archive page displaying posts in a date range
- Categories and Tags not working!
- WordPress custom post type archive with description
- Display Next/Prev when looping Custom post-types archive?
- Editable content on a Custom Archive page
- How can I filter by taxonomy on a custom post type’s page?
- How much control do we have over CPT rewrite slugs? Can I create a “root” page for my CPT with out the page path, and then have paths for other pages?
- how to add extra GET parameters to post to url with add_rewrite_rule?
- CPT Archive with core Category
- Custom post types and tag archive pages/permalink structure issue
- Rewrite slug of custom post type to include post-id
- Displaying Page as Custom Post type landing Page
- WordPress post_where & posts_join not working only for custom post type
- Rewrite Question Mark in Post Template to Make it Pretty URL
- How can achieve this permalink perfectly? domain.com/%category%/%post-name%
- WP Rewrite Rule Issue while using Custom post type & taxonomy
- CPT Template Not Showing – Getting 404
- Content Editable CPT Archive?
- How to get list of taxonomy slugs ordered parents>childs?
- remove base slug from hierarchical custom post type
- Rewrite Endpoints and CPTs – How to use in a plugin
- add_rewrite_rule and passing variables for custom post types
- Get url.com/post_type/taxonomy/term work!
- Paginate_links in custom post type template
- Limit the Title Length on Custom Post Type Archive Page to a Set Number of Characters
- Relationship between set rewrite flag in register_post_type and add_rewrite_rule
- Custom rewrite to fetch feed data
- Excluding a Custom Post Type with a specific tag using pre_get_posts
- custom post type archive page has 404 error even though has_archive is true
- Custom Post Type posts, conflict with posts after add_rewrite_rule to top
- Combine multiple CPT names to create valid permalinks
- sort CPT on Custom Taxonomy Archive page
- SEO Concerns With Rewrite Rules
- Rewrite permalink for multiple post types (CPT) with taxonomy term
- rewriterule not working
- Custom Post Type with modified permalink structure results in 404
- Modifying rewrite rules to use /category//
- add_action ‘init’ from inside a class for custom post types
- Custom post type archive – error in nav-menu-template.php
- Make Next and Previous on single-$posttype.php use the same order as archive-$posttype.php
- CPT archive page – show one post from each taxonomy term
- Subpages Permalinks Issues
- Get single posts archive information
- Invalid content when I try to import custom post type from the old template wordpress
- Rewrite URL for CPT to domain/post-name/post-id
- How to apply multiple rewrite_rule to a single custom post type url?
- Does this archive template part look like its making too many calls to the db?
- Finding the CPT archive template source
- Custom permalink structure for custom post types including multiple taxonomy
- Custom Post type page content (archive page)
- Posts per Page on custom Taxonomy Template
- Group custom post type posts by month
- Creating an archive page or simple template to list all values of a custom field of specific post type listing
- Rewrite url for custom post type with specific url
- Custom post pagination not working
- Custom Post Type / Taxonomy / Term – what template to use to avoid 404-page?
- get_permalink() of page the enclosing page not posts
- Default custom post type url
- How to build overlapping custom post_type and taxonomy rewrites without conflicts?
- How to manage a custom post type archive as a page?
- How do I get the posts from single page custom post type from a sidebar to display in a page?
- Permalinks for a custom post type – with a page template (custom query) and taxonomy archive
- how to use two permalinks for one custom post type based on categories
- WordPress custom post type rewrite rule matches all pages returning 404
- Rewriting archive page slug to be different than custom post type slug
- Custom post types archive
- Custom Rewrite Tag Structure
- Parent cpt/child custom post type URL permalink relationship
- How to make nested custom post type slugs work
- How can I set up the URL for a category archive for a custom post type?
- Create a Page Templete to Display Table Of Content for Custom Taxonomies
- Custom Post Types using wrong template (index) instead of archive-{type}.php – previously worked as expected
- How to add custom permalink struct with DYNAMIC author to a Custom Post Type
- Need help creating a WordPress site that has a landing page and sub pages for an area (for example, “London”). Website will have 100’s of areas