Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * WCV Vendor | Use %store% in Products' permastructure settings
- */
- function pm_wcv_shop_name($default_uri, $native_slug, $post, $slug, $native_uri) {
- // Do not affect native URIs
- if($native_uri == true || empty($post->post_type) || $post->post_type !== 'product') { return $default_uri; }
- if(strpos($default_uri, '%store%') !== false && class_exists('WCV_Vendors')) {
- $store_name = WCV_Vendors::get_vendor_shop_name($post->post_author);
- $default_uri = str_replace('%store%', sanitize_title($store_name), $default_uri);
- }
- return $default_uri;
- }
- add_filter('permalink_manager_filter_default_post_uri', 'pm_wcv_shop_name', 3, 5);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement