Just in case someone comes here to copy pasta without looking at the codex.
THE APPROPRIATE FILTER IS »template_include
«
As Radek pointed out that method can destroy your theme.
Additional information: The article »Don’t use template_redirect to load an alternative template file« by Mark Jaquith, where he says, in a nutshell, template_redirect
is for redirects, template_include
is for includes.
Related Posts:
- How to create custom home page via plugin?
- Can Page Templates be Applied to Archive and Post Templates?
- Force HTTPS 301 redirect with hook
- How to remove/replace current page template?
- Redirection from a specific page for users logged in but not with membership
- redirect_to how to make it simply work with get parameter or similar?
- How to get the path to the current theme?
- Why does WordPress use outdated jQuery v1.12.4?
- How can I add an option to the Page Template list from a Plugin?
- What is an alternative method to the WordPress private _doing_it_wrong() function
- template_include (overriding default plugin templates via current theme)
- Should I create a theme or a plugin?
- Check for featured image in WP_Query
- Update exisiting site to 3.5 release candidate
- Get file headers in custom file
- add_filter and remove_filter added before and after wp_query
- What is the difference between strip_tags and wp_filter_nohtml_kses?
- Custom theme sufficient or custom plugin neccessary for this feature set?
- Having Problem On Getting WP Post Gallery Images URL
- How to: get main plugin/theme file?
- Dynamically override page.php or single.php with custom templates using function
- add_theme_support using a plugin
- How to bundle a plugin with a theme, or vice versa
- How Can I setup WP CLI on Windows development machine running AMPPS?
- WP_LOCALIZE_SCRIPT doesn’t work
- What is the difference between these two methods of writing $ instead of jQuery in WordPress [closed]
- Modify a Free Plugin available on wordpress.org & include with my Premium Theme? [closed]
- Best choice of options/settings framework for plugin/theme development
- Is there any way to have Featured Text, as opposed to Featured Image?
- Find source of notice / warning / errors efficiently
- StackExchange clone using WordPress?
- Sharing common functionality (functions, template parts) between plugins and themes?
- Get Current Menu Location inside Nav_Walker
- Set page template programaticlly in plugin
- Short code not working in boostrap modal dont no why?
- Is there a way to list all actions registered by a plugin or theme?
- Howto: Use Custom Post Types as Submenu Items in Admin
- On cliking add new post redirect user to a custom page first
- Show custom data instead of 404
- Elementor custom Query with ACF fields to show matching woocommerce products custom fields
- How developed with version control word press site on shared host? [closed]
- wp_redirect on base wp-admin and login
- How to limit number of number of categories displayed by categories widget
- PowerPress mobile media player
- When is the proper time to minify css and js with git workflow?
- How to hide or rename “X” and “x-child” references in website source?
- Add a new confirmation page before saving
- Warning: include(): https:// wrapper is disabled in the server configuration by allow_url_include=0
- Plugin is not generating title tags on any pages or posts
- Is it necessary to do validation again when retrieving data from database?
- Make a plugin page out of influence of the theme’s style
- Update Data parameter of a wp_localize_script() call
- get_the_tags with separator control?
- 400 Bad Request, in wordpress theme development, wp_ajax
- Add child pages to submenu automatically
- Why in this archive page that call query_posts() function show only the last 10 posts?
- Create page (not the post type) dynamically
- Why would you use esc_attr() on internal functions?
- How to find where an object first instantiatiation
- Full documentation about $args for register_rest_route?
- How to get terms for taxonomy
- How to replace settings in WordPress plugin from a theme
- Save temporary registration data
- Add code to template dynamically
- WordPress dynamic widget by location?
- How can the_excerpt (or equivalent) be called on a category description?
- Change the behaviour of a button
- WP_Query order posts by category
- Configuring Xdebug with docker compose
- Custom payment method after payment user is logged out on thank you page
- How to access index file in Block Themes?
- WordPress Favicon not Working For Images/Videos/PDFs
- Detect if requested page is PWA on server side
- Want to know how to reveal a WordPress theme, considering the theme name is hidden?
- Conditionally check if page is using template from plugin directory
- Is it possible to develop themes and plugins locally while still allowing content to be updated directly in the admin dashboard?
- Error Connecting to Database WHEN Installing WordPress on XAMPP [Tried All the Usual Stuff] (Pics Included)
- How to save multiple values in custom post type from front end to back end
- Replace “content-area” of themes 404 page with plugin?
- Autoloading & Namespaces in WordPress Plugins & Themes: Can it Work?
- Custom premium registration form and profile page for a WordPress Web Application
- My enqueue admin style function doesn’t work because of ?=ver
- How to destroy or dispose wordpress uploder/manager?
- Unable to link CSS file
- Font Awesome stopped showing icons, shows &# text instead [closed]
- To remove rendering of menus and header, plugin or theme?
- To remove rendering of menus and header, plugin or theme?
- Managing Custom Designed Content
- How to load another page file of my custom plugin file
- Generate activation url
- Display Data’s metabox in page
- Ajax functions – no access to wp-admin.php only online
- Saving multiple fields as array
- How can I make my website with wordpress having on-spot editing feature as compared to concrete5 CMS?
- Loading jQuery library from WordPress admin
- Gutenberg text field validation
- how to catch a data from a array in WordPress
- How react js and other Javascript Technologies works on WordPress plugin?
- Template Redirect Function Only Working When Logged In
- Remove Gutenberg Buttons Block