If I understand you correctly, you could try to replace:
add_rewrite_rule( '^prefix-(.*)', 'foo/bar/index.php?page=$matces[1]', 'top' );
with
add_rewrite_rule( '^prefix-(.*)', 'foo/bar/index.php?page=$matces[1]', 'bottom' );
From the Codex:
‘
top
‘ will
take precedence over WordPress’s existing rules, where ‘bottom
‘ will
check all other rules match first. Default: “bottom
“
Related Posts:
- Why isn’t is_page working when I put it in the functions.php file?
- Get the ID of the page a menu item links to?
- Custom page with variables in url. Nice url with add_rewrite_rule
- Disable visual editor on one specific page
- How can I programmatically create “child” pages on theme activation?
- How to display error messages using WP_Error class?
- How do you permanently remove default rewrite rules from the wp_options table?
- Slugs as breadcrumbs for Pages
- Check if has any sidebar active on current page
- How to add .htaccess code through a function?
- Remove Page Title from Static Frontpage
- Target a certain page within wordpress backend (admin) i.e. Pages > About
- Breadcrumb how i can display page title with parent > child title with permalink ? any Idea
- add_rewrite_rule with bottom priority doesn’t handle the WordPress pages
- Enqueuing Script in functions.php vs on the page
- Programmatically set page template based on page ID
- Delete pages and Create default pages for all new network sites
- how to change link of some wordpress pages
- Make menu structure match page heirarchy on page parent change
- Change the slug of a particular page every x hours
- wp_insert_posts keeps adding multiple pages
- How to include local menu based on page id?
- Batch update menu_order attribute alphabetically
- is_account_page() change to page slug
- Don’t delete a page if it holds users
- List all-childpages on parent-page AND list child-pages on childpage itself but not the current one?
- Display post shortcode content in the sidebar?
- Why is my page feed returning empty content?
- Function only on a specific page
- Functions For Calling Specific Elements
- Get page id or status by private pages?
- What is the text that appears beside the page titles in the list of pages in the WP admin?
- Enqueue script on every page except one
- Page get parameter doesn’t work with is_single() function
- How to store a number (coming from cookie) into query vars for later usage in other filters?
- How do I register a new settings page? [closed]
- Only echo Page Content (not page title & page content together)
- get content from page through AJAX
- How to assign php file(template) to several pages with same prefix page name/slug
- Custom route and extract data from slashes and parameter
- How Can I Create a Friendly Slug for a Dynamic Page?
- Remove the delete link from pages without a plugin
- Change is_front_page() to is_page() to display ‘hero’ on entire site?
- Define an extra field for all pages (with no plugin?)
- Custom field not updating via functions upon publishing
- How to use WP_rewrite?
- Using array page name together with page id to deregister script
- How to add a class name to the ancestor of a post?
- How to add an excerpt and read more link to a page?
- My website is generating weired url parameters of paginated pages
- What’s the difference between esc_html, esc_attr, esc_html_e, and so on?
- Is it possible to rename a post format?
- Is there a hook or function I can use to display all theme files being used on a current page?
- How can I remove the title “leave a reply” in the comment box in twentyeleven?
- Child theme – overriding add_image_size by a child theme [duplicate]
- Login using the password from protected pages
- Remove tag on my RSS Feed
- Automated mark posts as featured every day
- Enqueuing External Javascript functions.php
- Child Theme Not Overriding Parent Theme
- How to override enqueued styles using a child theme
- How to make applyFilters function return false via functions.php
- How to call custom function from functions.php in site-wide template files?
- syntax issue on php 7.4
- retrieve current user meta data (custom fields included)
- Calling a function from anywhere, used in different places
- How do I redirect all 404 error url to Subcategory url
- get_next_posts_link not working without parameter max_num_pages
- create filter in functions.php
- Logout Shortcode URL
- Add Custom Background Properties to Customizer
- WordPress functions.php – Execute plugin specific user online
- Redirect to another page using contact form 7? [closed]
- Trying to register script in footer
- Can I have an additional functions.php file in WordPress?
- Shotcode argument issues
- Need php code’s output to display underneath a Divi Module
- Need help with customalert that it would read on a normal page, but not in WordPress
- Child theme function.php causes fatal error
- Best way to disable sidebars on posts (only)?
- How to print the current post depth as update notification?
- How to safely edit functions.php
- Linking Javascript in functions.php file
- Enqueueing scripts selectively & activation where needed
- Using One Function To Create Two Different Shortcodes
- Change Page Title
- How to Not Show posts on Category page?
- Put images in the media from url functions
- Paragraph spaces in email template function
- Including Font Awesome in a Custom Theme
- How would I correctly implement a new if statement in a child functions file?
- How To Show Shortcodes In WordPress Custom Fields?
- Language Switch Function
- How to debug function file causing white screen
- Author info does not show up when author has no posts
- Load CSS conditional on custom field is present
- Modify sub_menu function to show pages below a specifically set page
- Add custom class to all URLs on entire site
- Unregistering custom tinymce plugin?
- site_url is not honoring scheme