Skip to content

Redirect Posts

The Redirect Posts function automatically redirects visitors when they try to access posts with specific statuses. Use this to redirect pending, draft, or unpublished posts to a custom URL.

Overview

When users try to access a post that’s pending review or in another non-published status, WordPress may show a 404 error or the post content. This function lets you redirect them to a more useful page instead.

Key Features

  • Redirect posts based on status
  • Configure different redirect URLs per post type
  • 301 permanent redirect for SEO
  • Catches posts before 404 errors
  • Works with all public post types

Setup Instructions

Step 1: Enable the Function

  1. Navigate to Voxel Toolkit → Functions in your WordPress admin
  2. Find Redirect Posts in the list
  3. Toggle the switch to enable the function

Step 2: Configure Redirect Statuses

  1. In the Redirect Statuses section, select which post statuses should trigger redirects
  2. Common choices: pending, draft, private
  3. Click Save Changes

Step 3: Set Redirect URLs

  1. For each post type, enter the URL to redirect to
  2. Use full URLs (e.g., https://yoursite.com/coming-soon/)
  3. Click Save Changes

Configuration Options

Redirect Statuses

StatusDescription
pendingPosts awaiting review
draftUnpublished drafts
privatePosts only visible to admins
futureScheduled posts not yet published

Per-Post Type URLs

Configure different redirect destinations for each post type:

  • Places: → /explore-places/
  • Events: → /upcoming-events/
  • Jobs: → /job-board/
  • Posts: → /blog/

How It Works

  1. User tries to access a post URL
  2. Function checks the post status
  3. If status is in the configured list, redirect is triggered
  4. User is redirected with a 301 (permanent) redirect

SEO Note

The function uses 301 redirects, which tell search engines the redirect is permanent. This is appropriate for posts that shouldn’t be indexed in their current status.

Use Cases

Pending Listings

When a listing is pending review, redirect visitors to the main listing archive instead of showing an error.

Draft Content

Prevent users from accessing draft URLs (which could be shared accidentally) by redirecting to a relevant page.

Scheduled Posts

Redirect visitors who find scheduled post URLs before they’re published.

Troubleshooting

Redirect Not Working

  • Verify the function is enabled
  • Check that the post status is in the configured list
  • Ensure a redirect URL is set for the post type
  • Check for caching issues

Wrong Redirect URL

  • Verify the URL is entered correctly in settings
  • Ensure URL includes https:// or http://
  • Check that the destination page exists

Logged-In Users Still Seeing Posts

Note: users who can edit the post are never redirected — an author or editor following a link to their own unpublished listing sees it as normal. Everyone else is redirected.

A post must have a slug for its URL to reach the redirect

WordPress does not give a slug to a post that has never been published, so /events/some-title/ never pointed at that post in the first place — the request 404s before any plugin can identify which post was meant. Pending posts with a working URL are ones that were published at some point and later unpublished.

If a pending post's URL returns a plain 404 instead of redirecting, check that a redirect URL is filled in for that exact post type. The URL is stored per post type, and a post type with no URL falls through to WordPress's normal 404.

Built by Code Wattz.