1. Home
  2. /
  3. Web Design & Development
  4. /
  5. WordPress
  6. /
  7. How to Fix the Pagination Issue or 404 Page After Yoast – Dropping of Post Category Slug From the URL?

How to Fix the Pagination Issue or 404 Page After Yoast – Dropping of Post Category Slug From the URL?

How to fix the pagination issue or 404 page after Yoast – dropping of post category slug from the url?

Pagination is a crucial aspect of any website, as it helps in navigation and provides an organized way to browse through a series of pages. However, after removing the post category slugs from the URL using Yoast SEO, many websites face pagination issues, leading to 404 errors. In this article, we will discuss the solution to fix pagination issue and avoid 404 errors caused by the removal of category slugs from the URL using Yoast SEO.

In this blog, you will explore what a pagination issue of a website is, hot to fix pagination issue with simple steps & examples, importance of fixing this isue, and so on.

Let’s take an example to understand the working.

By default, if you have created categories in your WordPress website you will see the following URL structure.

Related: How to fix MySQL Port conflict issue on XAMPP?

What is a Pagination Issue?

Pagination issue refers to a problem that affects the navigation of a website, particularly when it comes to browsing through a series of pages, such as posts, articles or products. This issue can manifest as broken links, error messages, or incorrect display of pages.

It can occur due to incorrect settings or configurations in the website’s code, or due to compatibility problems with plugins or themes. When a pagination issue occurs, users may be unable to access certain pages, or the navigation may not work as expected.

Pagination issue is also known as a pagination error or a pagination problem.

Related: What is Web Hosting Solution?

Category Archive or Post Listings URL restructuring

https://makemypost.com/category/health-fitness/
https://makemypost.com/category/web-design-development/

The paginated page will appear as:

https://makemypost.com/category/web-design-development/page/2/

Now, suppose… you want to drop this “category” prefix from the above URLs and simply want to keep the URLs as:

https://makemypost.com/{your-category-slug}/

https://makemypost.com/health-fitness/
https://makemypost.com/web-design-development/
https://makemypost.com/web-design-development/page/2/

To do this change, you simply need to use the Yoast Plugin – Remove the categories prefix? option.

It can be found inside the Search Appearance >> Taxonomies tab (Scroll down to the bottom).

Category Archive or Post Listings URL restructuring
To switch it on or remove the Categories prefix. Change the settings to “Remove” and click on save changes to save these configurations.

Related: How to Implement Infinite Pagination in WordPress?

Post URL restructuring

By default, your article post URLs are as https://makemypost.com/{post_slug}/ or, https://makemypost.com/health-fitness/

And, if you want the URLs to have the category name or slug as a prefix. You have to do changes to the permalink structure of your WordPress website.

Click on Settings >>Permalinks

And, make sure… your settings reflect as the attached screenshot.

Post URL restructuring

i.e. Select the “Custom Structure” option and include the %category%/%postname%/ in the text field.

Save the changes.

This will make the post URL to work as:

https://makemypost.com/{category-slug}/{post-slug}

Or, https://makemypost.com/web/top-5-useful-wordpress-plugins-for-your-website/

With the above changes, you will have your URLs on the website well structured to handle both categories and category posts. But making such changes might cause some 404 issues in the pagination. Specifically, if you have the entire posts using a separate slug-like “blog” or “resources”. Example:

https://makemypost.com/blog/{category-slug}/{post-slug}/
Or,
https://makemypost.com/resources/{category-slug}/{post-slug}/

To handle such cases you need to add the following piece of code in your themes functions.php file.

function remove_category_slug_url($query_string){ 
    if ($query_string['name'] == 'page' && isset($query_string['page'])) {
        unset($query_string['name']);
        list($delim, $page_index) = explode('/', $query_string['page']);
		
		if(empty($page_index)) $page_index = $query_string['page'];
		
        $query_string['paged'] = $page_index;
    }      
    return $query_string;
}
add_filter('request', 'remove_category_slug_url');

This code will ensure, you don’t have any 404 concerns in the paginated URLs of any category or index pages.

Also read: Why You Should Choose SEMrush for Your Website SEO

How to Fix the Pagination Issue?

To resolve the pagination issue or 404 page after Yoast SEO plugin dropped the post category slug from the URL, follow these steps:

  • Go to the WordPress dashboard and click on “Settings” > “Permalinks.”
  • Select “Custom Structure” and add “/%category%/%postname%/” to the custom structure field.
  • Save changes.
  • Visit the website and check if the pagination issue is resolved.
  • If not, go to “Settings” > “Reading” and change the “Blog pages show at most” value to a smaller number (e.g. 5).
  • Save changes.
  • If the problem still persists, try re-saving the permalinks by going to “Settings” > “Permalinks” and clicking “Save Changes” without making any changes.
  • If the problem still exists, try installing and activating a plugin such as “Regenerate Thumbnails.”
  • If the problem still persists, try deactivating all plugins and switching to a default theme like Twenty Twenty.
  • If none of the above steps work, contact Yoast support or a WordPress developer for further assistance.

Related: How to Remove or Disable Comments on a WordPress Website?

Importance of Fixing Pagination Issue?

Fixing a pagination issue is important for several reasons:

1. User Experience

A pagination issue can negatively impact the user experience on a website, making it difficult for users to find the content they are looking for.

2. Search Engine Optimization (SEO)

Search engines may have difficulty indexing a website’s content if there are broken links or error messages, which can harm the website’s search engine rankings.

3. Website Functionality

If a pagination issue affects the website’s functionality, users may not be able to access certain pages or navigate the website effectively.

4. Credibility

An unreliable or broken website can damage the credibility and reputation of a business, especially if it affects user experience and functionality.

Therefore, fixing a pagination issue is important for ensuring a seamless and positive user experience, improving the website’s search engine optimization, maintaining the website’s functionality, and maintaining the credibility of the business.

Also read: The Ultimate Guide on ChatGPT Tool for 2023

Conclusion

In conclusion, fixing the pagination issue caused by the removal of category slugs from the URL using Yoast SEO is crucial to provide a smooth and organized browsing experience to the users. By following the solution discussed in this article, you can effectively resolve the pagination issues and avoid 404 errors on your website. Implementing these steps will improve the overall functionality of your website and provide a better user experience.

Rate this post
Reviews & Ratings Get your stoe online with Shopify in 60 minutes Shop Now