You may take a look at my 404 Tools plugin. I run a filter on '404_template'
there. The filter function is getting the template URL as an argument, and it is still possible to send HTTP headers.
You could hook into this filter too, prepare some data you may need to print out later, change the template (eg.: to single.php
) and add a do_action( 'print_my_custom_data' );
to your single.php
.
Related Posts:
- Which hook should be used to add an action containing a redirect?
- Making a plugin file accessible via url rewrite?
- Custom admin_notices Messages Ignored During Redirects
- Filter to change the content of 404 page
- Pages 404 in wordpress
- Set a specific page as 404 – not found via my own plugin
- Custom rewrite rule serves content, but returns 404 error code
- How to redirect to action on custom page within admin section
- Redirect user to a particular link in 10 seconds after using wp_die
- Change template dynamically
- On cliking add new post redirect user to a custom page first
- Force HTTPS 301 redirect with hook
- Add a new confirmation page before saving
- How to redirect to login page when user not loggedin on a particular page
- If $var is empty, return 404.
- Form submission to another page returning 404 error [duplicate]
- Is there any way to pass messages from a script to a redirect target in a hidden fashion?
- Custom payment method after payment user is logged out on thank you page
- Check current URL is 404 in pre_option_stylesheet filter hook
- How to Login a User inside a Plugin and Redirect to page?
- Add New Button in Admin Panel
- Redirection from a specific page for users logged in but not with membership
- Redirect WooCommerce checkout to cart
- Creating a return url for getting data from external api
- Scripts/styles not loading on cloned WP Site when logged in
- redirect_to how to make it simply work with get parameter or similar?
- Unable to link CSS file
- Any way to make Apache’s internal redirect work?
- How to load another page file of my custom plugin file
- Redirections the right way inside a plugin directory
- Plugin – Proper way to handle 404 pages?
- Custom rewrite, url path with parameters to a page
- All Pages and Post are redirecting to 404 Not Found in wordpress
- Objective Best Practices for Plugin Development? [closed]
- add_menu_page() with different name for first submenu item
- Autoloading & Namespaces in WordPress Plugins & Themes: Can it Work?
- How to include PHP files in plugins the correct way
- How can I add an image upload field directly to a custom write panel?
- A tool to analyze rewrite rules? [closed]
- Difference Between Filter and Action Hooks?
- framework for plugin/theme options panel? [closed]
- Creating a table in the admin-style?
- How to force a 404 on WordPress
- How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?
- Settings API with arrays example
- How to get the path to the current theme?
- How to make a plugin require another plugin?
- ajaxurl not defined on front end
- What process do you use for WordPress development? [closed]
- What’s the difference between term_id and term_taxonomy_id
- Should I use wpdb prepare?
- Why does WordPress use outdated jQuery v1.12.4?
- Post meta vs separate database tables
- Is there any plugin development framework
- Is it possible to reuse wp.media.editor Modal for dialogs other than media
- How to add a javascript snippet to the footer that requires jQuery
- Enhance Media Manager for Gallery
- How do I create a custom role capability?
- How do I add CSS options to my plugin without using inline styles?
- How do i best handle custom plugin page actions?
- Adding Custom Text Patterns in the WP 4.5 Visual Editor
- Redirect Restricted Page to 404
- Automatically determine minimum WordPress version required for a plugin?
- What is the advantage of using wp_mail?
- How to make a WordPress plugin translation ready?
- How many times will this code run? (or, how rich is grandma?)
- How to create an API for my plugin?
- Is it ever okay to include inline CSS in plugins?
- Plugins in symlinked directories?
- How to override existing plugin action with new action
- How to include a file using get_template_part() in a plugin?
- Add custom TinyMCE 4 Button, Usable since WordPress 3.9-beta1
- How to store username and password to API in wordpress option DB?
- How to prevent automatic redirection of 404 errors and “incorrect” URLs?
- body_class hook for admin pages
- “Error: Options Page Not Found” on Settings Page Submission for an OOP Plugin
- Is it mandatory to use $wpdb->prefix in custom tables
- add_action hook for completely new post?
- Why does WordPress add 0 (zero) to an Ajax response?
- What should I use instead of WP_CONTENT_DIR and WP_PLUGIN_DIR?
- How do I skip wordpress’s 404 handling and redirect all 404 errors for static files to 404.html?
- How to enqueue JavaScripts in a plugin
- In Which Contexts are Plugins Responsible for Data Validation/Sanitization?
- Plugin Form Submission Best Practice
- How to redirect to settings page once the plugin is activated?
- Is get_option function cached?
- Should Plugin Folders Include a Blank index.php File?
- Unit testing for plugin development
- Methods of Integrating Plugin Data with Themes
- What is the wordpress wp-includes folder for?
- WordPress Update Plugin Hook/Action? Since 3.9
- How to include jQuery and JavaScript files correctly?
- How come `wp_options` table does not have an index on `autoload`?
- PHP error with shortcode handler from a class
- Update Option Stored in Multi-Dimensional Array
- check if Gutenberg is currently in use
- Best way to abort plugin in case of insufficient PHP version?
- WordPress Plugin Development – Headers Already Sent Message
- WP 3.3 How to Add Menu Items to the Admin Bar?
- dbDelta not creating tables