Finally I found the solution myself.In case you are also having similar problem, add the following two lines
global $wp_rewrite;
$wp_rewrite->flush_rules();
Related Posts:
- Disable Single Post View for Specific Taxonomy on Custom Post Type
- How to make “single post” permalink maintain it’s sub-page structure
- Single page problem when permalink type changed
- Can I have a specific template for products even if they are standard posts and not CPT?
- How do I get the permalink of a custom post type?
- Shouldn’t this be easy?! Custom post type/custom taxonomy permalink
- WordPress 3.3 custom post type with /%postname%/ permastruct?
- Custom Post type & Taxonomy URL structure
- Combining Multiple Taxonomies in one URL
- Taxonomy term in permalink
- Custom Post Type Archives by Date with Custom Permalink
- Why does a custom post type need the ”hierarchical’ args setting?
- How to modify URL structures in custom post types and taxonomies or terms
- Modify custom post type rewrite rules in a separate function
- Slug for custom post type archive
- Permalink rewrite with custom post type and custom taxonomy
- Permalinks in Custom Post types
- Custom Post Type with Nested Taxonomy and Template Files
- Semantic URL Custom Post Type and Taxonomies permalinks
- Disable WordPress Recognizing Path as Attachment
- custom post type and custom taxonomy url conflict
- Passing parameters to WordPress static front page
- Possible for Category Base and Custom post Type to share the same slug/permalink?
- pagination redirecting from page number url before page requested
- 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?
- Removing parent slug in hierachial custom post type
- Wrong generated page_name/slug on first publish of custom post type
- Stop / prevent WordPress from updating permalinks of custom post type
- How do I correct an incorrect permalink?
- Update permalinks when new category added to custom post type taxonomy
- Tag Archive for Custom-Post-Type Posts yielding 404 when permalinks set to postname
- Why doesn’t a custom post type permalink ever hit index.php
- How to change custom post type permalink structure
- 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
- create a subcatagory for a custom post type and out put url as posttype/subcategory/item
- Show custom post archive when custom post not specified
- Show custom post type relationships by taxonomy
- Completely remove custom post type permalinks (“One Page” website)
- Need help with permalink rewrites for Custom Post Types with hierarchical relationships
- Permalinks: custom post type -> custom taxonomy -> post
- Custom post type permalink tag 404
- Custom permalinks rules don’t match and lost of query var in the process
- single-{post_type}.php not working
- How to Create Template File for Parent Page of Custom Post Type
- Changed permalink structure of CPT – should I redirect?
- How to hyperlink content from archive page with custom post-type
- retrieve permalinks of posts inside custom post type by using post ID
- Custom post type permalink sends to 404.php
- Post will not load via ajax
- Template for custom post type when taxonomy is in the URL
- Custom Post Type posts, conflict with posts after add_rewrite_rule to top
- How to change base in tag URL for custom post type, to not use “Custom Structure” set in Permalinks setting?
- Combine multiple CPT names to create valid permalinks
- How to add a sub directory to WordPress single posts without affecting other post types?
- Which is the neatest way to have homepage articles and a blog?
- Custom rewrite rules for /pastissues/%category%-%postname%.html
- Make Next and Previous on single-$posttype.php use the same order as archive-$posttype.php
- Subpages Permalinks Issues
- Multiple permalinks for a single post with multiple taxonomies
- Stop displaying Permalink
- Permalink with hierarchy of Custom Post Types
- Rewrite URL for CPT to domain/post-name/post-id
- Custom Endpoint For Specific Custom Post Type
- How do you create pillar content pages?
- Custom permalink structure for custom post types including multiple taxonomy
- Custom post type single page returning 404 error when sharing archive url with custom taxonomy
- Shortcode and get_template_part
- Customise Permalink Structure For Custom Post Types
- Two and more diffrent custom page type in one permalink
- Some permalinks on Apache/localhost development setup return 404’s when set to anything other than plain permalinks
- How can i remove post type archive URL?
- Page as parent for CPT and other pages
- Two CPT: one is using part of the custom rewrite slug from the other
- Custom permalink with custom taxonomies for custom post type
- Change the url of a custom post type to include taxonomy
- how to use two permalinks for one custom post type based on categories
- How to set class to “current-page” on the currently viewed single post within a CPT
- Can I override the permalink/slug on creation
- Multiple custom post type and permalink issue
- Pulling in Related Posts based on Post Type array
- Remove sequential number from permalinks
- Permalinks when using Custom Post Type with static page for archive
- How to change permalinks to taxonomy and post type’s posts
- Have two (permalinks) urls for a same custom post type
- change precedence of permalink for post_types?
- Redirect permalinks after creating custom post types
- how to load custom single.php?
- Parent cpt/child custom post type URL permalink relationship
- How to make nested custom post type slugs work
- Custom Post Type Permalinks Problem
- Problems with custom post type and hierarchical permalinks
- Custom Post Types and 404 Pages
- Posts picking up old Permalinks, how to reset?
- Remove slug from Custom Category Permalink + dual-category permalinks
- WordPress Set A Static Page/Template For All Sub-Pages
- Get permalink in custom post type loop doesn’t work
- How to add custom permalink struct with DYNAMIC author to a Custom Post Type
- Custom post type Premalinks main page and details page
- Permalinks for Custom Post Types and Taxonomies