[ad_1]
See if this works for you,
- Open your theme’s
functions.phpfile or create a custom plugin file for this purpose. - Add the following code to modify the rewrite rules for your custom post type:
function modify_gva_team_rewrite_rules($args, $post_type)
{
if ($post_type === 'gva_team') {
$args['rewrite']['slug'] = 'staff';
}
return $args;
}
add_filter('register_post_type_args', 'modify_gva_team_rewrite_rules', 10, 2);
- Save the changes to the
functions.phpfile or your custom plugin file. - After saving the changes, visit the WordPress admin area and navigate to “Settings” > “Permalinks.” Simply clicking the “Save Changes” button will flush the rewrite rules.
This code uses the register_post_type_args filter to modify the rewrite parameter of the “gva_team” post type registration. It checks if the current post type is “gva_team” and updates the slug value to “staff”. This way, the base URL will be changed from /teachers/ to /staff/.
Perfect solution! Thanks, @abretado1985! ❤️
