Changed URL formats to be like:
/services/home-care/COUNTY/TOWN
add_rewrite_rule(
'services/([^/]*)/([^/]*)/([^/]*)/?',
'index.php?post_type="ag_location"&ag_primary_inspection_cat=$matches[1]&ag_cities=$matches[3]',
'top' );
add_rewrite_rule(
'services/([^/]*)/([^/]*)/?',
'index.php?post_type="ag_location"&ag_primary_inspection_cat=$matches[1]&ag_county=$matches[2]',
'top' );
add_rewrite_rule(
'services/([^/]*)/?',
'index.php?post_type="ag_location"&ag_primary_inspection_cat=$matches[1]',
'top' );
Based on this solution
Related Posts:
- How does WordPress handle permalinks?
- Get page permalink without wpurl
- Can I use REST-API on plain permalink format?
- How to change ‘with_front” key from an existing custom post type?
- Post titles not letting me use 2 consecutive dashes in permalink
- Make post slug have priority over category slug
- Adding anchor to paginate_links + Safari anchor bug
- How to stop permalink redirects for a particular slug
- Why does WP not use relative links when linking pages?
- Posts not working on windows after changing permalinks
- Custom permalink structure
- How to get rid of index.php?
- Remove Custom Taxonomy Slug from Permalink
- WordPress Links Not Working After Migration
- Migrating WordPress blog to New Webhosts, something is adding a # and gibberish
- Adding File Extensions to Attachment Page Permalinks
- Can two products with the same name but different category produce unique URLs?
- Permalink settings not saving
- If the only permalink setting is %postname% what happens in the case of old duplicates?
- Get closest page ID from URL
- How to create thousands of endpoints for a post or a page or a custom post type programatically?
- AWS WordPress Install – pages/posts 404 on restart until updating permalinks
- How to add_rewrite_rule with two parameters to a single view page?
- WordPress get permalink function
- Site moved to HTTPS and loads as HTTPS but permalinks show as http
- Exclude / Blacklist Permalinks
- Point domain to different webhost’s subdirectory wordpress
- 404 Error Problems with sCategory Permalink plugin
- Default setting permalink /blog/
- Need help getting my Permalink structure right
- Redirect Uploads Folder to Query Vars in WordPress
- how to link post-thumbnail to original img in a lightbox?
- Losing preview ability: W3 Total Cache + Post name permalinks
- Get the url of a page template without using the page slug and ID
- flush_rewrite_rules breaks permalinks
- How to show permalink auto when type text in post tiltle?
- Accessing Subdirectories in WordPress Install
- Permalink for custom post type
- Change Permalink of attachment page
- How to use different domains for different blogs hosted in the same host in subdomains with .htaccess
- Custom permalinks in WordPress
- How can I say if a URL is a post, page, or taxonomy archive?
- Custom post type clean shortlink
- cannot link a external url, present page url acting as parent url
- add_rewrite_rule on default post type
- how to find duplicated permalinks?
- the_content(); erroneously closing off previous opening before it
- Bulk append URL (add word to slug)
- Conditional Permalink based on category?
- Permalink Custom Page Template
- How do i get post thumbnail using attachment code
- permalink error when modifying sanitize_title_with_dashes function
- The requested URL was not found on this server [closed]
- Shortcodes not working
- How to create posts or pages with the names in wordpress?
- WordPress permalink not working on subdomain
- Xampp 7.3.3 fresh install of WordPress 404 pages unless permalink is set to plain
- How to construct a dynamic rewrite rule for child pages that passes more than one query var
- Extending page urls without getting a 404
- Permalink conflict with React Router in subfolder
- 404 on pretty permalinks when serving via HTTPS
- Add /blog prefix for all WordPress front end url
- Permalink structure has suddenly changed
- How to experiment with permalink structure on a select number of posts
- In a multisite, how can I get posts from one site and display their permalinks in another site?
- Why does page for hierarchical taxonomy parent term go 404?
- Custom permalink gives 404 error only in some pages
- Can I link to content dynamically from a page to a new page?
- Custom permalink for one category
- No Ones Been Able to Override my WordPress Rewrite Rule Issue!
- Remove index.php from URL (WP installed in subdirectory)
- Choose permalink on a per-post basis?
- Single.php not loading when permalink only contains date information
- WooCommerce product permalink changed
- Different Permastruck Between Ajax Request & Normal Request
- Imported posts using wrong domain name
- Is there a way to add slug to home_url on this function?
- Problem with multiple tags in URL
- Custom Permalinks and filters?
- Customized author slugs not working with get_author_posts_url method
- Custom WP permalink structure
- 404 error on second page load for child-pages
- Permalink structure as code in back-end?
- Internal Server Error every time I push up my WordPress Project to Heroku
- region selection
- Redirecting From An Old Permalink Structure
- WordPress custom permalinks, pages are now 404
- WordPress home page showing 404 error
- Include language variable in url
- Is it posible to translate a url prefix?
- AllowOveride All causes assetts and Admin Urls to 404
- Page permalinks are http but show up as https?
- Error: “Sorry, this content could not be embedded” when using the Embed block
- WordPress Permalinks 404 Not Found
- WordPress 6.1.1 UTF8 Slug Limit Increase
- 301 Redirect posts to newly added categories
- How to have category/subcategory/posttitle/ permalinks?
- WordPress not remembering old slugs for pages
- make a new structure tag that does some processing
- Website appears with wrong permalink in Google’s search