The flush rewrite rules to be considered while when custom posts are generated.
More info here
https://codex.wordpress.org/Function_Reference/flush_rewrite_rules
This worked for me as when my theme is activated every thing works file
/* Flush rewrite rules for custom post types. */
add_action( 'after_switch_theme', 'flush_rewrite_rules' );
Related Posts:
- How to filter to output of the get_permalink() function
- WP JSON list all permalinks
- Filtering comment permalinks when a condition is met
- Remove the Parent category from the permalink but leave the child category
- How to hook into permalink when publishing-saving post?
- Multilanguage URLs
- Changing post content on save, using updated fields
- is there a way to add the post URL to the results of fselect facet in Facetwp plugin?
- Process all virtual sub pages on parent page
- Permalink slug no longer editable when using post_type_link filter
- WordPress Permalink feature alternative
- Inserting a string in the middle of page’s permalink?
- Access or edit custom generated permalinks with WP_Rewrite
- Custom child page permalink
- Remove character from permalink
- Edit the output of a filter
- Fire a code when permalinks updated
- Edit Post Permalink option removed, looking for possible causes
- I can get the permalink or the excerpt to work correctly, but not both
- Search and replace post URL’s on page output?
- Custom Permalinks and filters?
- Once redirected by Rewrite rules, how can WordPress know the page?
- How to update permalink on the fly?
- Getting the terms from “Beautiful Taxonomy Filters” Results ot Integrate into “Ajax Load More”
- Rewrite permalink with PHP processing
- Why is “/page/2/” not working?
- How does WordPress handle permalinks?
- Why would Numeric permalinks work, but %postname% won’t?
- Passing variables through permalink structure
- Remove subfolders from URL
- Why does WP not use relative links when linking pages?
- Convert hyphen to underscore in permalinks
- htaccess or redirect to cloak portion of a link?
- What is the action or filter for changing permalink in Edit Post/Page?
- Migrating WordPress blog to New Webhosts, something is adding a # and gibberish
- How to get wordpress link to fully evaluate when coming from facebook
- Is using %postname% for permalinks really that bad for performance?
- How to tranform Headlines into linkable permalinks?
- Best way to add internal link in widget
- Changing search URL to something other than “search”
- How to Filter categories in the permalink structure
- Changes to .htaccess not updating the file (old rules still take effect)
- article pages not displaying on local instance of wordpress site
- breadcrumbs & rel=”nofollow”
- Force pretty permalinks?
- WordPress get permalink function
- WordPress Permalinks & Nginx Rewrite Rule Not Working
- Page and Category With Same Slug – Looking To Silo Website
- Override category permalink to match old non-WordPress links?
- filtering special chars from post slug
- How to change old permalink?
- Losing preview ability: W3 Total Cache + Post name permalinks
- Get the url of a page template without using the page slug and ID
- Broken Link in WP Site?
- How to change “attachment_id” in attachment permarlink?
- How to use different domains for different blogs hosted in the same host in subdomains with .htaccess
- Custom permalinks in WordPress
- Permalink opens attachment instead of page
- How do I get thumbnail generator to recognize the_permalink tag?
- Changing WordPress routing to load the same page for different URLs
- Custom post type clean shortlink
- Exclude single page from permalink rule
- the_content(); erroneously closing off previous opening before it
- Bulk append URL (add word to slug)
- Image URL and size
- defining child page permalink
- Browsing to permalink prefix results in 404
- Shortcodes not working
- replicate url permalink after migrating to wordpress
- I need to change the attribute of the isPermaLink guid in the WordPress RSS feed – from false to true
- Shortlinks work only for logged in users
- Changing permalink for blog posts, current structure www.website.com/blog-post, change to, www.website.com/blog/blog-post
- Does wordpress take care of slug collisions?
- WordPress permalink not working on subdomain
- Fatal Error when trying to load Permalinks page on WP admin [closed]
- How to construct a dynamic rewrite rule for child pages that passes more than one query var
- Cannot publish posts or pages when I change permalink structure
- Add /blog prefix for all WordPress front end url
- Permalink structure has suddenly changed
- Remove Permalink of certain posts
- Bulk update set of URLs via SQL
- Custom permalink for one category
- rebuilding/ rewriting a url to make it SEO friendly
- Very strange behaviour related to htaccess and custom posts and custom posts substrings (BUG?)
- Permalink change during save of post
- Changed Permalinks settings, how do I redirect posts on Nginx?
- Choose permalink on a per-post basis?
- How to put articles under a /blog directory?
- Category-dependent custom permalink
- Pretty permalinks (again)
- Passing user defined variable into get_permalink
- WordPress Archives Cause Looping
- Is there a way to add slug to home_url on this function?
- Customized author slugs not working with get_author_posts_url method
- Custom WP permalink structure
- region selection
- Redirecting From An Old Permalink Structure
- How to change my URL on intranet
- Include language variable in url
- Is it posible to translate a url prefix?