How to apply multiple rewrite_rule to a single custom post type url?
How to apply multiple rewrite_rule to a single custom post type url?
How to apply multiple rewrite_rule to a single custom post type url?
I wasn’t linking to the page correctly in the rewrite rules. The use of pagename was incorrect instead I should have used page_id. The rewrite rules I ended up using was add_rewrite_rule(‘^resa/start/?$’, ‘index.php?page_id=1897&route_page=start’, ‘top’); add_rewrite_rule(‘^resa/planera/?$’, ‘index.php?page_id=1897&route_page=plan’, ‘top’); add_rewrite_rule(‘^resa/dela/([^/]+)/?$’,’index.php?page_id=1897&route_page=share&share_id=$matches[1]’, ‘top’);
After SO MANY research, I found a Great Simple solution via https://stackoverflow.com/a/54251892/10403689 (vote this ⬆UP⬆) Your Permalink Structure should be: /%category%/%postname%/ function no_post_slash( $string, $type ){ if($type == ‘single’) $string = untrailingslashit($string); return $string; } add_filter(‘user_trailingslashit’, ‘no_post_slash’, 70, 2); BUT this is only working on single_post not pages
Create different permalinks for same post
Generate custom output on URL with directory
Adding custom query var to a single post without redirecting to its root slug
WordPress rewrite with custom parameter doesn’t work
Custom Post Type add_rewrite_rule
add_rewrite_rule() issue with parent/child/child page
Is it possible to change redirect template through a shortcode?