Translating some Slugs causes issues with the generated pages

When I use the following snippet that I got from the Github snippet collection, it seemingly translate the slug correctly, however, it removes the page-id-xx from the page.

add_filter(
	'hivepress/v1/post_types',
	function( $args ) {
		if ( isset( $args['request'] ) ) {
			$args['request']['rewrite']['slug'] = 'missions';
		}

		return $args;
	},
	100
);

So what this does is that it the request page I have set in hivepress/settings/requests, with a page-id-61 selector, now gets overwritten by some other template.

The URL: https://www.mysite.com/missions/ directs to the new page without the page-id-61 tag.
However, if I change one of the letters in the slug to a capital, like this https://www.mysite.com/misSions/ it now directs to the page-id-61 page, with the same template being added, however, now customizable with the page-id-61 tag.

I have tryed clearing cache and refreshing permalinks. This does not solve the problem.

Hope it was understandable. I think I need a different way to rename/translate the url-slugs that this snippet, because it seemes to add alot of mess :slight_smile:

Hi,
This snippet shouldn’t affect the page CSS classes at all, it override the post type config only. We recently added options for editing permalinks without code changes in Settings/Permalinks, please try changing it there instead of adding a snippet.

You are right. This works way better.

May I ask where “Categoryprefix” and “Tagprefix” is applied?

also, I can’t seem to be able to translate follow slugs:

the account page slug:
account/vendor/dashboard/

listing submit:
/submit-listing/details/

request submit:
/submit-request/details/

Thank you

If possible send more details about prefixes, do you mean attribute-based taxonomies?

Slugs that are not based on post types or taxonomies (like the mentioned ones) are static rewrite rules, it’s possible to customize them but via the hivepress/v1/routes hook. Please consider leaving them as is because these are not public URLs anyways, they are not indexed by the search engines and users may not care about the texts in the browser address bar.

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