Custom post type slug localization

First, you should have to register your custom post type with a generic, language-independent slug because the slug in register_post_type is not meant to be dynamic. and then modify rewrite rule try this snippet function register_custom_post_type_services() { $labels = array( ‘name’ => _x(‘Services’, ‘Post Type General Name’, ‘text_domain’), ‘singular_name’ => _x(‘Service’, ‘Post Type Singular Name’, … Read more

Right Permalink for Custom Post Type with number slug

You need to write a rewrite URL for the galley, please see the below code and paste into your active theme functions.php file function gallery_custom_rewrite_rule() { add_rewrite_tag(‘%gallery_id%’, ‘([^&]+)’); // Rule to handle numeric slugs in a gallery post type add_rewrite_rule( ‘^gallery/(.+)/([0-9]+)/?$’, ‘index.php?post_type=gallery&gallery_id=$matches[2]’, ‘top’ ); } add_action(‘init’, ‘gallery_custom_rewrite_rule’, 10, 0); function gallery_query_vars($query_vars) { $query_vars[] = ‘gallery_id’; … Read more