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';
    return $query_vars;
}

add_filter('query_vars', 'gallery_query_vars');

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş