Hello guys how are you? Welcome back to my blog therichpost.com. Guys today in this post, I will tell you How to include vendor name in Permalinks, Dokan?
Guys if you are new in WordPress or in WooCommerce then please check the below links for some good tutorials:
Here is the working steps and please follow carefully:
In Dokan, you can include the vendor name in permalinks by modifying the vendor store URL structure. Here’s how you can do it:
1. Enable Vendor Store URL with Vendor Name
Dokan automatically assigns a store URL for each vendor. To ensure the vendor name appears in the permalink:
- Navigate to Dokan → Settings → General.
- Find the “Store URL” option and ensure it uses the vendor’s name.
2. Customize Permalinks for Vendor Products
If you want to include the vendor name in product permalinks:
- Go to WordPress Dashboard → Settings → Permalinks.
- Under Product Permalinks, you may need to select “Custom Base” and add
/vendor/%vendor_name%/%product_name%/
. - Use a plugin like Permalink Manager Lite to further refine the structure.
3. Modify Permalinks Using Code (Advanced)
If you want deeper customization, you can add the vendor name dynamically using custom functions:
function custom_dokan_vendor_permalink($permalink, $post) {
if ($post->post_type == 'product') {
$vendor_id = get_post_field('post_author', $post->ID);
$vendor = dokan()->vendor->get($vendor_id);
if ($vendor) {
$vendor_slug = $vendor->get_shop_slug();
$permalink = home_url("/vendor/{$vendor_slug}/" . $post->post_name);
}
}
return $permalink;
}
add_filter('post_type_link', 'custom_dokan_vendor_permalink', 10, 2);
Would you like help implementing this on your site? 🚀 Feel Free to comment below.
Ajay
Thanks