The issue is that %month% isn’t a recognized rewrite tag. If you add the tag within your init action and flush permalinks, the query will succeed.
function register_story_post_type(){
// your post type registration stuff here, and then…
add_rewrite_tag( '%month%','([^&]+)' );
}
add_action('init','register_story_post_type');
There are also about a hundred ways you could otherwise clean up that code, but none relevant to your issue here. One thing I recommend though is to not manipulate rewrite globals directly, this is a bad habit that can get you in trouble if the underlying code changes. Always use the API and avoid globals. Your story rewrite tag is added when you register your post type, and the rewrite structure can be defined directly within your post type registration code using the rewrite argument.
Related Posts:
- Mixing custom post type and taxonomy rewrite structures?
- How to rewrite URI of custom post type?
- Rewriting a custom-post-type permalink with taxonomy term?
- Add .html (dot HTML) extension to custom post types
- Custom rewrite rules for archive page and single post
- WordPress Rewrite Rules for Custom Post Type and Taxonomy
- Custom post types – Use post_id in permalink structure
- Multiple post types – share same ReWrite slug?
- Custom post type permalink: only use %post_id% and remove %postname%
- Custom post types – Use post_id in permalink structure when using has_archive => true
- Rewrite custom post type rss feed links
- Using /%postname% for a custom post type
- Changing the URL Structure of a Paginated Custom Post
- How to modify URL structures in custom post types and taxonomies or terms
- rewrite get parameter with custom post type
- Permalinks so that one custom post type appears to be a child of another, not working
- Create permalink structure for one taxonomy archive per custom post type
- Slug for custom post type archive
- Custom permalinks
- Permalink rewrite with custom post type and custom taxonomy
- Custom post type permalink changing itself every other change
- Make permalinks based on an ACF-field
- Remove unwanted part of permalink custom structure from CPT url?
- Custom post type’s get_permalink returns wrong url
- Prepend meta_value to permalink of post
- Custom Permalinks for Custom Post Types and Taxonomies
- Custom Post Type with Nested Taxonomy and Template Files
- Removing parent slug from URL on custom post type
- Permalinks for CPT breaks permalinks to pages
- URL rewrite and navigation structure for wordpress custom post type
- Changing a custom post type “has_archive” after registered
- How to rewrite custom post type URL for multiple depths instead of one specific depth
- Custom post type category, taxonomy and URL rewrite problem
- Rewrite on custom post type permalink not working?
- WordPress Rewrite rule for nested post types
- Custom Post Type slug same as page name causing a conflict
- Rewrite Custom Post Type URL slug
- Permalinks for Taxonomy and Custom Post Type
- Share parent path between Custom Post Types and Pages?
- multiple url slug for single custom post type
- Custom Post Type and Custom Taxonomy Permalinks
- Rewrite URL for only archive page (custom post type)
- Change URL of posts and also Custom Post Type
- Custom taxonomy in URL showing 404
- Rewrite rules for custom posts types
- 404 Issue w/ Custom Post Type – using Meta for Permalink rewrite
- How to change custom post type permalink structure
- Adding custom post category slug in permalink causes 404 error for pages and posts
- How can I use get_post_meta with add_rewrite_rule to build custom permalinks?
- How Can I Change the Custom Post Type Slug to the Taxonomy Slug in the URL?
- Use same slug base for Custom Post Type posts, and multiple taxonomy terms
- How to create custom url structure based on custom post type rewrite slug, taxonomy and category slug?
- How can achieve this permalink perfectly? domain.com/%category%/%post-name%
- Using taxonomy term in CPT permalink – Pages 404’s
- How to add rewrite rule to custom post type with parent in url with cpt ui?
- Custom post type as home page with custom url
- URL rewrite add author as base
- Custom Permalink to remove category word , keeping posts permalink with date?
- Custom Permalinks with CPT and Hierarchical Taxonomies
- Custom Permalink Structure for Custom Post Type, Custom Taxonomy, Under a page
- CPT’s with landing page instead of archive – Url Rewrite?
- Permalink structure with custom taxonomies and custom post type like /parent-tax/child-tax/custom-post-type-name (with no base name)
- Ignoring slug capitalization on rewrite rule for custom post type archive page
- Lost of query parameter when using permalink
- Permalink misbehaving in Custom Post Types
- Best way to specify “article type” in URL
- How to have permalink like domain.com/term/postname?
- Combine multiple CPT names to create valid permalinks
- Route subpage to Custom Post Type
- Custom Post Type Advanced Slug
- Dynamic CPT permalink structure based on ACF field value
- Rewrite permalink for multiple post types (CPT) with taxonomy term
- Post type Permalink
- WordPress custom permalink and archive link for custom post type
- Custom Post Type nest under a normal WordPress Page
- custom posts permalinks url rewriting
- Use a different URL path / permalink for CPT
- Adding /blog in front of single posts (only)
- 404 error rewrite permalinks
- I want to rewrite the URL of a specific post with a specific custom field to easily analyze in Google Analytics
- Rewrite URL for CPT to domain/post-name/post-id
- Custom permalink structure for custom post types including multiple taxonomy
- Permalinks: custom post type -> custom taxonomy -> custom sub taxonomy -> post
- Pretty Permalinks with CTP and Taxonomies / Hierarchical
- Customise Permalink Structure For Custom Post Types
- How to make “single post” permalink maintain it’s sub-page structure
- Two CPT: one is using part of the custom rewrite slug from the other
- WordPress custom post type rewrite rule matches all pages returning 404
- Custom post type with parent page? Possible?
- Remove sequential number from permalinks
- Customizing the custom post type permalink
- Parent cpt/child custom post type URL permalink relationship
- Custom Post Type – Rewrite slug [duplicate]
- How can you preserve URLs when moving posts to a custom post type?
- Rewrite rules for using the same base slug for multiple content types
- Custom post type permalink structure
- Custom post type Premalinks main page and details page
- What is the best way to relate different custom post types?
- Allow child pages with the same base as the CPT slug
- How to make 2 (or more) custom post type post pages sit under the same slug?