Hi @harkad17,
And that services, I created in “Services”
The “Services” is called a custom post type, which isn’t a default feature in WordPress. It’s either part of the theme or plugins which has added “Services” as a post type.
The initial reply was to update the code if it was added by you using a custom code, but it doesn’t sound like that.
The “Services” is only present because a specific plugin or theme is activated, so what could be suggested to modify it is limited since I’m not sure how it was added.
However, could you please try and see whether the following snippet helps:
<?php
function change_service_post_type_args( $args, $post_type ) {
if ( 'service' === $post_type ) {
$args['rewrite']['slug'] = 'servis';
$args['rewrite']['feeds'] = true;
$args['rewrite']['pages'] = true;
$args['rewrite']['with_front'] = false;
}
return $args;
}
add_filter( 'register_post_type_args', 'change_service_post_type_args', 10, 2 );
You can implement the above code using mu-plugins. Please check this link on how to implement the above code as a mu-plugins:
https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins
Please make sure you have a backup before you make the recommended changes.
Once the snippet is added, you’lll have to refresh the permalink in your WP dashboard under Settings > Permalinks and by clicking the “Save Changes” button and then check whether that changes the slug.
The current code changes the slug from service to servis, you can update the snippet according to your need.
If you still face issues with the above method then most probably it would mean the existing plugin/theme is preventing the snippet from working and it’s something you’ll have to check with the respective plugin/theme support on how to update within the plugin or theme.
Kind Regards,
Nithin