Possibly the place to do this would be in the 404.php file of your theme. If there isn’t one, create one and WordPress will pick up. Note: if you want to return “non-404” content from this file you will probably need to clear the headers and set the status to 200.
I’ve done something very similar on other systems and it works fine if you take care to return the correct headers.
One word of warning though: you might want to minimise the amount of processing that happens on the this page as otherwise you might end up impacting site performance if you start lots of processing on every single 404.
Related Posts:
- Get Posts Under Custom Taxonomy
- When is the ‘post_content_filtered’ column in database cleared by WordPress?
- Can posts have parents?
- Where is the old post permalink slug stored?
- How to show related posts by category
- Separate Database Tables For Different Post Types
- get_children() Not Working with orderby Parameter
- How to get all posts related to particular category name?
- get all posts ID from a category
- How can I safely increase the character limit for post passwords?
- How to Group Posts by the First Letter or Number?
- get comments and get posts in loop
- Restore contents of deleted user
- How are terms connected with posts in database?
- How to know if get_posts() failed?
- Moving WordPress to new server: no posts found
- Import custom database into wp and keep the post id
- Get posts from current category?
- why the posts queried from sql is more than those showed on the page?
- Moved to a new server, backup was a day old and missing 3 posts, anyway to recover them from old host?
- Is there a function to get post info for any publish_status by post ID?
- Your ideas on my though “delete or move all of the posts in a specific category when 3 days are passed”
- How Can I Always Display A Particular Post First Using WP_Query?
- Help on conditional statement to accompany wp_insert_post function please?
- How to add content above footer in posts from specific category
- How can I globally italicize list of texts in the UI database or Posts? [closed]
- Is it possible to modify posts table to only read for more recent ones?
- How to show multiple posts thumbnail, title and date in widget
- I need to create “View Profile” and “Edit Profile” links by incorporating the Post Title/ID, but can’t seem to manage it
- Show only posts with titles/permalinks that do not contain certain words
- How to merge the content of posts that have the same title?
- How to add first 3-4 post tags on WordPress Post Title
- get posts, run a custom query, and join the results
- Menu Items disappearing/being empty on save or post edit
- My website is showing today’s date instead of published date since db migration to a new wordpress
- How to setup default value of post_id
- Prevent a post with a specific ID from being created
- How to mark only one post as Featured post?
- Bulk find & replace on WordPress posts/pages (minus image paths)
- Reusing old post IDs
- Trigger on DB make problem on wordpress?
- get_next_post() not working with future post status
- Comments are in database, don’t show up in WordPress backend or frontend
- Extracting the permalink from a post instance
- Is there a way to save different data when USER interacts with the same POST?
- How can I stop ‘in use’ message from intermittently blocking my wp_posts table?
- REST API Working for GET but not for POST?
- Fill the exclude array() in get_posts()
- Posts page listing pages as well
- More Than 50K Categories and WordPress Admin Panel Stop Showing Categories and Posts
- how i show manual data in a post
- WP_Query to get posts in a specific tag or has post_format
- Clean up customize_changeset in DB
- How to Get Position of a Post from a category and tag
- How to add navigation arrows to manually slide through posts?
- How do I get a certain set of posts from the database?
- Maximum number of posts per page before affecting performance?
- How to convert return type of ‘get_posts()’ same as ‘wp_get_recent_posts()’?
- SQL trigger failes with post_content
- How to get all posts in gallery post format template
- Surrogate ID for posts, is there an alternative field in the posts table?
- Any difference betweenn posts and pages for one page?
- get backup file from wordpress database in x days
- Expired Post with More Recent Time Stamp?
- How to get the current user post and it’s ID?
- Converting Posts to Pages
- I moved my site to another server, wp admin works so does the front page, but posts don’t work
- How to change the publishing date of each posts?
- Can’t seem to replicate permalink structure for localhost development site
- Extra field in wp_post instead of postmeta
- Voting System, database connections?
- When I click edit on a post, all the content disappear. Does anyone know how to fix this?
- Retrieve latest post by multiple categories with ID
- Given two custom post types: Automatically add meta fields from one custom post type to another
- External link not showing on post but showing on comment
- How do I paginate posts page with $wpdb?
- How to get all post titles starting with numbers and symbols?
- Bulk Attach Or Insert Media To Post Without Opening Post Editor
- Displaying posts on Homepage
- How to get single post by one author?
- get_posts includes “auto drafts”?
- Is there a maximum amount of pages for a multi-page post?
- wordpress show category link instead of post link [closed]
- posts_per_page – Repeats only first posts ‘post__in’ array
- append $_GET parameters to post
- How to make category for word post_content
- NewsPaper WP Theme – Additional Related Posts Filter by Time (divTag composer)
- Word count for all posts of all authors
- What effect can a large wp_post table have on overall site performance?
- View post with specific category id and name which I selected in the backend (drop-down option)
- How can I merge a several related posts into one post?
- Restore posts, but only posts that exist in my database backup
- Change permalinks in posts via SQL
- Translation related post text to Arabic
- Is it safe to totally unregister the default “post” Post Type
- How to get a list of all posts and their categories?
- How can I guide user to the next unread post within category
- How to show related posts by detecting the current category?
- How to manually delete post from database without causing conflicts?
- Can’t save/get Patterns’ `post_content` attribute