Created
June 18, 2020 16:54
-
-
Save PhongGCS/4ecb0c4199709fc75b2e05a00d84e239 to your computer and use it in GitHub Desktop.
Add rewrite for wordpress
This file contains 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
function prefix_movie_rewrite_rule() { | |
add_rewrite_tag('%state_id%', '([A-Za-z0-9\-\_]+)'); | |
add_rewrite_tag('%state%', '([A-Za-z0-9\-\_]+)'); | |
add_rewrite_rule ( 'states/([A-Za-z0-9\-\_]+)/([A-Za-z0-9\-\_]+)', 'index.php? | |
state_id=$matches[1]&state=$matches[2]', 'top' ); | |
} | |
add_action( 'init', 'prefix_movie_rewrite_rule'); | |
function leep_rewrite_url_posts() { | |
add_rewrite_tag('%id_post%', '([A-Za-z0-9\-]+)'); | |
add_rewrite_rule ( 'pt-detail/([A-Za-z0-9\-]+)', 'index.php?pagename=posts&id_post=$matches[1]', 'top' ); | |
} | |
add_action('init', 'leep_rewrite_url_posts'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment