This Is How to Fix the WordPress "Custom Post Type Permalinks" Plugin 404 Error
As a WordPress website owner, you may have encountered the frustrating issue of the "Custom Post Type Permalinks" plugin generating 404 "Page Not Found" errors. This can be a major roadblock in your website's user experience and search engine optimization (SEO) efforts.
In this article, we'll dive deep into the root cause of the problem and provide you with step-by-step instructions on how to fix the 404 errors and set up custom permalinks for your post types. Whether you're using the Tourmaster plugin or any other custom post type, this guide will help you overcome this challenge and optimize your website's URL structure.
Understanding the Problem
The issue with the "Custom Post Type Permalinks" plugin generating 404 errors often arises when you're trying to customize the URL structure of your custom post types and their associated taxonomies.
In your case, you'd like your tour post URLs to follow the format:
www.sitename.com/$category_father/$category_child/$name_of_my_post
And your tour taxonomy URLs to follow the format:
www.sitename.com/$category_father/$category_child
However, the default behavior of the Tourmaster plugin is to generate URLs in the following format:
- Tours:
www.sitename.com/tour/$name_of_my_post
- Tour Categories:
www.sitename.com/tour-category/$category_child
To address this, you installed the "Custom Post Type Permalinks" plugin, which partially solved the issue but still resulted in 404 errors.
The plugin-generated URLs were:
- Tours:
www.sitename.com/tour/$category-father/$category_child/$name_of_my_post
- Tour Categories:
www.sitename.com/tour/tour-category/$category_father/$category_child
Unfortunately, these URLs were not accessible, leading to the dreaded 404 errors.
Fixing the 404 Errors
To resolve the 404 errors and set up the desired URL structure, we'll need to take a multi-step approach. Let's dive in!
Step 1: Deactivate and Uninstall the "Custom Post Type Permalinks" Plugin
The first step is to deactivate and uninstall the "Custom Post Type Permalinks" plugin. This will ensure that we're starting with a clean slate and not dealing with any potential conflicts or issues caused by the plugin.
- Log in to your WordPress admin dashboard.
- Navigate to the "Plugins" section.
- Locate the "Custom Post Type Permalinks" plugin and click "Deactivate."
- Once deactivated, click "Delete" to remove the plugin from your website.
Step 2: Modify the Tourmaster Plugin Code
Since the Tourmaster plugin is responsible for the core functionality of your tours and tour categories, we'll need to directly edit its code to achieve the desired URL structure.
- Navigate to the
wp-content/plugins/tourmaster/include/tour-option.php
file in your WordPress installation.
- Locate the following code block:
'rewrite' => array(
'slug' => 'tour',
'with_front' => true,
),
- Replace the
'rewrite'
array with the following:
'rewrite' => array(
'slug' => '%category%/%category-child%/%post_name%',
'with_front' => true,
),
This new rewrite rule will generate the desired URL structure for your tours:
www.sitename.com/$category_father/$category_child/$name_of_my_post
- Save the changes to the
tour-option.php
file.
Step 3: Modify the Tourmaster Plugin's Taxonomy Code
Now, we need to update the code responsible for the tour category URLs to match the desired format.
- Locate the following code block in the
tour-option.php
file:
'rewrite' => array(
'slug' => 'tour-category',
'with_front' => true,
),
- Replace the
'rewrite'
array with the following:
'rewrite' => array(
'slug' => '%category%/%category-child%',
'with_front' => true,
),
This new rewrite rule will generate the desired URL structure for your tour categories:
www.sitename.com/$category_father/$category_child
- Save the changes to the
tour-option.php
file.
Get a Free AI Website Audit
Automatically identify UX and content issues affecting your conversion rates with Flowpoint's comprehensive AI-driven website audit.
Step 4: Clear the WordPress Permalink Cache
After making the changes to the Tourmaster plugin code, you'll need to clear the WordPress permalink cache to ensure that the new URL structure is properly applied.
- In the WordPress admin dashboard, navigate to the "Settings" > "Permalinks" section.
- Click the "Save Changes" button, even if you haven't made any changes to the permalink settings.
This will flush the permalink cache and update the URLs on your website.
Step 5: Test the New URL Structure
Now, it's time to test the new URL structure for your tours and tour categories.
- Create a new tour post and observe the generated URL. It should follow the desired format:
www.sitename.com/$category_father/$category_child/$name_of_my_post
- Navigate to a tour category page and verify that the URL follows the desired format:
www.sitename.com/$category_father/$category_child
If you encounter any further issues or 404 errors, double-check your code changes and ensure that the Tourmaster plugin is properly configured.
Optimizing for SEO
To further optimize your website's SEO, consider the following additional steps:
-
Update Internal Links: Update any internal links on your website that point to the old tour and tour category URLs. This will ensure a consistent user experience and prevent broken links.
-
Submit a Sitemap to Search Engines: Generate a new sitemap for your website and submit it to search engines like Google and Bing. This will help them quickly discover and index the new URL structure.
-
Monitor for Redirects: Keep an eye on your website's analytics and look for any 301 redirects from the old URLs to the new ones. This will help you identify and address any lingering issues.
-
Optimize Page Titles and Descriptions: Ensure that your page titles and meta descriptions are optimized for the new URL structure and include relevant keywords. This will improve your website's visibility in search engine results.
By following these steps, you'll be able to successfully fix the 404 errors caused by the "Custom Post Type Permalinks" plugin and set up a clean, SEO-friendly URL structure for your tours and tour categories.
If you're looking for a powerful analytics solution to help you further optimize your website's performance, Flowpoint.ai offers comprehensive website analytics and AI-powered recommendations to boost your conversion rates