Created
March 23, 2025 06:23
-
-
Save arfinmilondev/10d186e385570cce28fbdfc97162e1bc to your computer and use it in GitHub Desktop.
Set permalink to post after theme activated in WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /*---------------------------------------------------- | |
| Set permalink to post after theme activated | |
| -----------------------------------------------------*/ | |
| add_action('after_setup_theme', 'reset_permalinks'); | |
| function reset_permalinks() | |
| { | |
| global $wp_rewrite; | |
| $wp_rewrite->set_permalink_structure('/%postname%/'); | |
| $wp_rewrite->flush_rules(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment