URL Rewrite fires when retrieving a custom value?
URL Rewrite fires when retrieving a custom value?
URL Rewrite fires when retrieving a custom value?
I think you may be confusing parent pages (hierarchy) with page slugs (the URL). Parent pages are designed to allow you to programmatically build things like menus/submenus and breadcrumbs. Whereas a page slug is the visual representation in the URL. Many times, of course, I’d recommend you make your page slug match your hierarchy (for … Read more
Custom post type’s permalink adds the name of the post type before the post name
Flat category URLs but retaining hierarchy?
Rewrite permalink for specific posts
Changing URL scheme, mod_rewrite not helping
The tutorial is outdated and it seems it missed to flush the rules. function add_rewrite_rule_and_tag() { global $wp_rewrite; add_rewrite_rule( ‘^physician-profile/([^/]*)/?’, ‘physician-profile?lastName=$matches[1]’, ‘top’ ); add_rewrite_tag( ‘%lastName%’,'([^&]+)’ ); if ( ! isset( $wp_rewrite->rules[‘^physician-profile/([^/]*)/?’] ) ) $wp_rewrite->flush_rules(); return; } add_action( ‘init’, ‘add_rewrite_rule_and_tag’, 99 ); You can access the query var `lastName´ with gloabl $wp_query; $lastName = $wp_query->query_vars[‘lastName’];
Within your rewrite() method add: add_rewrite_tag(‘%state%’,'([^&]+)’); add_rewrite_tag(‘%city%’,'([^&]+)’); That will keep the query_vars you added within the url, and prevent it from being stripped.
Lost of query parameter when using permalink
How to rewrite a URL to another rewritten URL without changing the address?