I had a similar thing just last week and I’ve got a solution and pushed the code up to github: https://github.com/deadlyhifi/wp_query_intercepter
Basically, it allows you to intercept an URL and choose to send a custom template file, or run anything you like based on the request.
It’s updated since my question on Rewrite loading custom template file but is_home() returns true, and there’s no 404
You should be able to change it to suit your situation.
And yes, Johannes Pille is correct, you shouldn’t change the core files. They will get overwritten at the next WP update and could cause other unexpected behaviour. You really shouldn’t need to anyway as just about everything in WP can be plugged into, filtered, or overwritten somehow.
Related Posts:
- Create page when plugin is activated
- Replace existing pages with new pages, keep menu links
- Distributing and packaging plugins
- Copyright messages for a particular set of pages
- View Private Published Page with URL Code (no login required)
- Run plugins only on certain pages
- Elementor: How to design Dropdown Select Box Navigation page like Chegg
- Give custom page template a custom post ID
- Adding LOAD MORE on a page
- Best approach to serve static content within a regular page
- Restrict my pages from public
- How to implement a customizable free OpenID authentication?
- Difference between add_filter and apply_filters
- Creating Unique Post URLs for A/B Testing… Is this even possible?
- How to delete the Hello Dolly plugin automatically?
- Show Similar Post Titles ( Similar to Stack Exchange )
- How do I unlock a post programmatically?
- Open external links in a new window
- jQuery plugin only in one page/post
- How can I limit functionality in one version of a plugin?
- How to add usermeta to “Notice of Email Change” email message
- Any way to use a custom Parameter for youtube embed without using an iframe?
- How to create a Page alias in WordPress
- How to extract images of post and pages excluding header and logo image in wordpress?
- WordPress 3.1 and Disqus throws Warning: number_format() error in Posts List
- How can I rewrite a plugin generated URL?
- WordPress and WebRTC?
- Leveraging WordPress Comments on Custom Plugin Object page
- Debugging Technique Question re: functions.php
- Is there a way to alter the order in which the plugins appear in the page?
- Getting Post details when post is published
- How to check what plugins used to be on a WordPress installation?
- Possible to replicate economist.com’s debate section in wordpress? [closed]
- FacetWP group listings by custom field [closed]
- Get IDs of Images from Gallery Block in InnerBlocks of a Custom Gutenberg Block
- How to embed HTML code from WP Coder plugin (or other) into Main Index Template of the theme
- WordPress plugin – Error “Plugin generate 2890 characters of unexpected output when activated”
- My plugin wants to update another plugin
- Remove Duplicator plugin from admin menu if not an administrator
- Add a custom form on the post-new.php admin page
- Edit Yoast SEO breadcrumbs output [closed]
- className not populating in custom block
- Display encrypted content on my website
- In the archive widget, how do I sort in between two years?
- Customization API for plugin development
- Fromcraft Plugin On click submit button [closed]
- creating a custom shop page display on archive woocommerce
- polylang + category/tag custom language link
- How to redirect users to their profile after they successfully edit their profile
- Creating Featured Content Boxes
- Add Content to Content()
- Customizing Titles on the Fly with Code
- Moving FB comments at the end of page
- Customizing a blog page layout
- Hide a certain category name from Related Posts
- how to add custom info on author page? plugin, child theme?
- Change website directory safely to add a static page on startup
- Price comparison table based on Custom Post Type?
- How to handle a WordPress blog with articles in different languages?
- display unique post per category
- How to dynamically change spots of text in custom page?
- Call javascript functions from each page
- How to display an alert when deleting a plugin?
- unregister a sidebar widget
- How to disable Wp-PageNavi at the top of the page
- 404 errors when updating options in admin dashboard
- Display WordPress comments before the plugins?
- Mobilepress fails to translate short codes
- woocommerce remove coupon link does not work
- Getting infinite scrolling working on my custom template
- Display posts by alphabetical order
- WordPress Frontend Page using Plugin
- Adding discount functionality to the cart
- Changing the CSS with a plugin
- Precheck fields when I add a new post
- working code, not working – Plugin Dev
- Allow a page to be edited by a specific custom role
- Custom wp_list_tables redirect on specfic page
- Paid Membership Pro displaying a user name in PHP
- Automatically check “Enable stock management at product level” to the existing products?
- How to disable users to view Other pages
- Creating Nested custom fields
- Multiple calling javascript from shortcode in one page
- History of page, interval of years
- Plugin does not create a custom table upon activation
- Disable default posts (Posts,Pages,Comments and Media) in wp-admin
- Get page content by ID (from a plugin)
- Plugin program: JQuery not working in this plugin
- How to set up php,javascript and css to allow for our finished product to be displayed within a page?
- admin panel save option with ajax
- Get page type to display content
- How to fix vanilla comments extra iframe space
- Woocommerce quick checkout form [closed]
- How to add image for custom taxonomy
- Social network plugins for WordPress [closed]
- Why haven’t I see plugins using get_file_data to handle retrieving plugin version?
- Wrapping code in an if block
- How can I properly sanitize the update_option in WordPress?
- How to disable plugin capability : “create new category”
- Set the Social Icon Size in footer