I ended up solving this with a little bit of code (in the form of a plugin):
if(isset($_GET['state']) OR isset($_GET['city'])) {
$url = explode("https://wordpress.stackexchange.com/", $_SERVER['REQUEST_URI']);
$url = end($url);
$_SERVER['REQUEST_URI'] = "https://wordpress.stackexchange.com/" . $url;
}
This code in essence removes the “/arizona/” or “/arizona/phoenix/” from the REQUEST_URI global variable and replaces it with “https://wordpress.stackexchange.com/”, which then forces WP to serve up the front page template using index.php. Fixed!
Perhaps a few of you can vote this answer up for me. 🙂
Related Posts:
- Newbie question: no index.php? in my plain wordpress permalink
- Remove query string specific key value
- Dynamic content based on a URL parameter
- Create custom permalinks to show Custom Post Type’s relationship?
- How do i add slugs to a URL, but still redirecting to the same page
- Nginx WordPress and another Web app URL structure
- Why is home page content not displaying with this rewrite rule?
- How to deal with a GET variable of ‘name’?
- How to define a rule in functions.php that ONLY disables the default wp functionality that undesirably changes ‘&’ to ‘#038;’?
- Current WordPress Page Title as Search Parameter into A Tag
- How does one make a URL return dynamic JSON with custom Content Type?
- Can’t search posts using WP_QUERY inside AJAX Function
- How to query for pages/post depending on slug?
- How to rewrite URL with PHP variables with htaccess to a normal looking URL?
- How can I use wp_query to show all product data using just the products ID?
- Get Current User Id Inside a Loop Returns 0 For a Shortcode
- Random order of WP_Query results with highest meta value
- Custom page archive query by url var calling page twice on one of my custom queries?
- WordPress custom slug (endpoint) and compare all links
- Static variable and add_rewrite_rule?
- How to query for posts with a null or blank post_name?
- WordPress pagination not working with search page
- get current custom post ID by WP_Query method
- Nesting if statements to echo only one string based on what tag was filtered?
- How to securely provide a $_POST var in WP_Query with PHP 7?
- Using foreach loop breaks
- Create WP_Query to search for posts by their categories or their parent/child categories
- WP Query with custom Shortcode
- wp_query with cat not working
- Advanced Meta Query for Large Calendar Website (12k+ posts) (175k+ wp_postmeta rows)
- How to use an associative array in post__in with WP_Query?
- How to change home or site url using action hooks or filter?
- Why do WordPress rewriites seem to work differently for posts vs pages?
- Performance impact of rewriting WordPress URLs
- If Query In Sidebar
- Recent Posts slider, using WP_Query(), loads duplicate sliders
- Compare post-IDs within WP_Query? (Less than / Greater than)
- Is sanitize_title_with_dashes formatting function too liberal (in terms of accepted characters)?
- Rewrite custom post type URL parameters
- How to use $query->set with post__in?
- Why do WP_Query results change after updating unrelated Advanced Custom Fields (ACF)?
- Loading the same WP_Query in two different wordpress .php templates
- How to prevent WP_Query function from returning all posts when empty?
- Display a specific category of products in shop page and disable code for specific actions
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- Change pagination url format
- Colon is Missing In My Website Url in WordPress
- Changes in permalink structure in WordPress and how to apply to in-site links
- WordPress Persistent connection rule does not work for “posts”
- How to change redirection route to a php page for making it only accessible by logged-in members?
- How to use $_GET function WordPress backend
- Add more button if more 8 items
- How to store post ID’s in cookie or session to display the same posts later
- Append query string to all URL’s
- custom rewrite rule help! Custom rewrite rules not applying to custom post type
- WordPress, AJAX and pre_get_posts using conditional tags
- subdirectory index.php is not working
- Get users that likes the post
- Use URL Rewrite as well as $_GET parameters in URL?
- How to modify URL (add GET values) after front end form submission?
- get_posts() and WP_query limits ‘AND’ conditions to a maximum of 6 for meta value queries in WordPress
- Exclude posts based on meta value
- Extend PHP regex to cover “srcset” and “style” attributes
- parts of url disappear when using # inside href=”” [closed]
- Recent Posts Not Showing Only On A Specific Category Page [closed]
- Custom query, checking values of multiple meta keys
- My php header() function is not working [closed]
- auto-populating custom nav with all items from custom post type
- inserting a post from an extern php file but post content doesn’t show on wp site
- Loading index.php contents which located outside blog folder for post single page
- Scrape external webpage for first image and add it to new post
- Remove echo from shortcode
- Add .htm extention to a custom taxonomy
- Search Query: how to construct a search string from two select elements?
- How Can I use WP_Query to Only Display 1 Post from Custom Post Type if Query Returns Posts with Matching ID in Custom Field
- Help with .htaccess and Login with Subfolders
- Changing URL scheme, mod_rewrite not helping
- Get URL Parameters from referer
- Need help enqueueing webfonts
- How can I hide that I Use WordPress (with W3 Total Cache)
- WordPress theme options error
- Redirect to another page using contact form 7? [closed]
- Security for data obtained from the database
- WordPress add_rewrite_rules for custom URLs ending in .html
- mod-rewrite exception? keep #hash in matching urls?
- Fatal error: Call to a member function query() on a non-object
- Get posts from multiple post type
- Is it possible to retrieve all posts with a certain value for metadata?
- How to get all author posts outside of author templates
- WP_Query fails despite having 1 post
- Create a Blog Template Page
- Why is $wp->request empty in WordPress 6.0?
- Get the URL of the page from which an ajax request has been launched within ajax callback
- unable to use ‘new WP_Query’ in AJAX call
- How to check if the current page is at a specified path in the URL?
- wp_query get the 2nd post
- Exclude posts with specific metadata from search?
- How to get post ID in a Page?
- Display an image if odd number of posts in grid
- How to retrieve the data from the sever and displaying it in a page?