Maybe in the custom_rewrite
function, try concatenating $wp_rewrite->rules
and $feed_rules
using array_merge
, then returning $wp_rewrite
.
function custom_rewrite( $wp_rewrite ) {
$feed_rules = array(
'local/(.*?)/(.*?)/?$' => 'index.php?page_id=41&trade=" . $wp_rewrite->preg_index(1)."&area=" . $wp_rewrite->preg_index(2),
"local/(.*?)/(.*?)?$' => 'index.php?page_id=41&trade=" . $wp_rewrite->preg_index(1)."&area=" . $wp_rewrite->preg_index(2),
);
$wp_rewrite->rules = array_merge($feed_rules, $wp_rewrite->rules);
return $wp_rewrite;
}
I haven”t tested that at all, just a suggestion of something to be looking at.
Related Posts:
- How to filter to output of the get_permalink() function
- WP JSON list all permalinks
- Filtering comment permalinks when a condition is met
- Remove the Parent category from the permalink but leave the child category
- How to hook into permalink when publishing-saving post?
- Multilanguage URLs
- How to change the permalink option to post name on theme activation?
- Changing post content on save, using updated fields
- is there a way to add the post URL to the results of fselect facet in Facetwp plugin?
- Process all virtual sub pages on parent page
- Permalink slug no longer editable when using post_type_link filter
- WordPress Permalink feature alternative
- Inserting a string in the middle of page’s permalink?
- Access or edit custom generated permalinks with WP_Rewrite
- Custom child page permalink
- Remove character from permalink
- Edit the output of a filter
- Fire a code when permalinks updated
- Edit Post Permalink option removed, looking for possible causes
- I can get the permalink or the excerpt to work correctly, but not both
- Search and replace post URL’s on page output?
- Once redirected by Rewrite rules, how can WordPress know the page?
- How to update permalink on the fly?
- Getting the terms from “Beautiful Taxonomy Filters” Results ot Integrate into “Ajax Load More”
- Rewrite permalink with PHP processing
- Strange permalink issue: can’t rename /company-2/ to /company/
- How to get permalink and title from post ID?
- Using $_GET variables in the URL?
- Removing leading zeros from custom permalink structure
- How do I turn off 301 redirecting posts (not canonical)?
- How can I include a query string with get_permalink
- Post being redirected to attachment post
- Without index.php in permalinks I get 404 across site
- Changing Permalinks to a Custom Permalink causes a 404 Error [no matter what I do]
- How to assign a Permalink to a Function
- How to get blog id from permalink?
- Rewrite-Rules not working on a vhost, everything goes to index.php
- Date archive permalink modification
- How to get this JavaScript working with get_permalink
- Change of permalink structure – redirects in htaccess breaks the archive links
- Changes to permalink structure results in 404 error for all pages other than home
- Filter string like a slug
- I need a custom permalink for my website
- 404 with post name permalinks
- Should there be a trailing slash in the permalink
- Link to external URL
- Woocommerce Product Attribute Permalink doesn’t work?
- Problem with wordpress links on a live site
- Permalink change redirects by WordPress [duplicate]
- WPML get permalink to the translated post from the original post
- page nested 3 levels deep shows 404
- Removing /author/ slug from URL gives 404
- Add custom post type name in term link?
- Can I create permalinks like this: /%post_type%/%postname%/
- Why the “Permalink” option is not showing in the “Settings”? [closed]
- How to get the full URL of the current page and change domain of it?
- Custom permalink structure: /%custom-taxonomy%/%post-name%/ (without CPT slug)
- get_permalink() is not working after published
- How can I get this custom post type permalink structure? %custom_post_type%-%taxonomy%-%term-postname%
- get_permalink returning site home url instead of the url of slug being passed
- WordPress add_rewrite_tag working for Posts, but not working for Pages
- Host frontpage via example.com and everything else via example.com/blog
- WordPress can generate numeric permalinks, which then 404
- Dynamic Custom Permalinks
- 404 error using Meta for Permalink rewrite
- WordPress suddenly changed all links to example.com/example.com/
- How to handle paging/pagination with a custom permalink?
- Environment independent way to link to certain pages on frontend
- Using one slug/post-name for multiple pages
- Custom URL rewrites for templates
- Gutenberg output URL to post from attribute with post ID
- How to change custom post type, blog post and page permalink by template?
- How to get raw unwritten querystring
- WordPress Permalink
- How to replace permalinks
- Keep wordpress basic permalink preferences
- Adding a ‘blogs’ prefix in the URL structure but only for blogs
- .htaccess to redirect to a wp page
- My WP homepage works, but the other pages don’t when accessing from out side of my network
- How do I use the same Tag slug for different Tags?
- Replacing + sign to – in wp Search Permalink
- Permalinks are not working in WordPress
- One post but two separate permalink structure and template views
- Retain Post title keywords in URL even if user changes post title or any other way to achieve SEO friendly permalink?
- HTTPS permalinks resulting in 404
- Changing Permalinks. Old links don’t work
- Automatically remove repeated words in slug
- Permalinks – Archives
- Dynamically populate permalinks
- Permalink not working
- When using number in url it is redircting to same page but when using character it redirects to 404
- Change Image depending on page path
- WordPress Permalinks 404 error
- How is a URL getting mapped to a page template
- customize urls displayed by previous_post_link and next_post_link
- Routing ‘fake’ sub sub posts
- Page and post auto links
- how to make follow?
- Permalinks Won’t Work
- Settings > Permalinks – mod_rewrite ineffective if expression not preceded by /index.php/