How to change the permalink option to post name on theme activation?
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’ );