Taxonomy URL Modification Issue

Hello!

I’m reaching out for assistance with an issue regarding the modification of taxonomy URLs. The original URL structure is as follows: https://domain.eu/listing-category/auto/

I am trying to modify it to: https://domain.eu/profession/auto/

I used the following code in the functions.php file:

<?php

add_filter(
	'hivepress/v1/taxonomies',
	function( $taxonomies ) {
		$taxonomies['listing_category']['rewrite']['slug'] = 'profession';
		return $taxonomies;
	},
	100
);

The code works in the sense that the desired URL structure is updated in the admin area. However, when I try to access the new URL in a browser, the content doesn’t load, and I receive a 404 error.

Steps I’ve Already Tried:

  1. Permalink Settings Refresh: I saved the settings again under Settings > Permalinks.
  2. Cache Clearing: I cleared both the website’s cache and my browser cache.

Unfortunately, these steps didn’t resolve the issue.

What could be causing this problem? Are there any additional steps or code adjustments I can implement to ensure the new URL structure works properly and the content loads without errors?

Thank you in advance for your help!

Unless I am mistaken, you don’t need a filter here. Just specify “profession” in the permalinks page where the label is listing categories.

Save. Done.

3 Likes

sorry, where i can find the permalinks page?, i have the similar issue.
I have been find in categories section and i couldn´t find it.

Thank you.

1 Like

Let me add something here. I have been struggling quite a bit to set it up, and thought it could be of use to some of you too :

In my case I have these settings in the permalinks :

Problem is : if user “shortens” /cat-freelances/some-cat/ to /cat-freelances/
it leads to a 404 page.

If I want to do a simple redirect via .htaccess from /cat-freelances/ to /freelances/, it will also redirect “children” pages, creating as many 404 pages, hence not a proper solution.

The solution is as follows :

#redirect root "page" /cat-freelances/ to /freelances/ but not children pages. 
RewriteCond %{REQUEST_URI} ^/cat-freelances/?$ [NC]
RewriteRule ^ /freelances/ [R=301,L]

Cheers !

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.