It is possible to edit the /accommodation/ slug in 2 ways:
Method #1
by editing translations of the plugin. This would let you change the default link:
https://your-site.com/accommodation/double-room
to
https://your-site.com/room/double-room
You may also edit the translation to change the following slugs of the Hotel Booking plugin:
/accommodation-category/
/accommodation-tag/
/accommodation-facility/ for Amenities
/service/
Note: After you edit translations for slugs you should navigate to Dashboard > Settings > Permalinks and Save changes to refresh the links.
Feel free to use the Loco Translate plugin to easily manage translations.
Method #2
by applying the codes below to the functions.php file of the theme:
Note: After you edit translations for slugs you should navigate to Dashboard > Settings > Permalinks and Save changes to refresh the links.
/accommodation/:
function theme_edit_slug_mphb_room_type( $args, $post_type ) {
if ( 'mphb_room_type' === $post_type ) {
$args['rewrite']['slug'] = 'apartment';
}
return $args;
}
add_filter( 'register_post_type_args', 'theme_edit_slug_mphb_room_type', 10, 2 );
/accommodation-category/:
function theme_edit_slug_mphb_room_type_category( $args, $taxonomy ) {
if ('mphb_room_type_category' === $taxonomy ) {
$args['rewrite']['slug'] = 'apartment-category';
}
return $args;
}
add_filter( 'register_taxonomy_args', 'theme_edit_slug_mphb_room_type_category', 20, 2 );
/accommodation-tag/:
function theme_edit_slug_mphb_room_type_tag( $args, $taxonomy ) {
if ('mphb_room_type_tag' === $taxonomy ) {
$args['rewrite']['slug'] = 'apartment-tag';
}
return $args;
}
add_filter( 'register_taxonomy_args', 'theme_edit_slug_mphb_room_type_tag', 20, 2 );
Comments
0 comments
Please sign in to leave a comment.