Skip to content

Instantly share code, notes, and snippets.

@hlashbrooke
Last active September 17, 2020 21:53
Show Gist options
  • Select an option

  • Save hlashbrooke/5954698 to your computer and use it in GitHub Desktop.

Select an option

Save hlashbrooke/5954698 to your computer and use it in GitHub Desktop.
WooCommerce Product Vendors: Change vendor URL slug
add_filter( 'product_vendors_vendor_slug', 'change_vendor_url_slug' );
function change_vendor_url_slug( $slug ) {
$slug = 'new_url';
return $slug;
}
@bo3lih

bo3lih commented Aug 1, 2016

Copy link
Copy Markdown

the code above is outdated since woothemes changed the filter name to wcpv_vendor_slug
add_filter( 'wcpv_vendor_slug', 'change_vendor_url_slug' );
function change_vendor_url_slug( $slug ) {
$slug = 'new_url';
return $slug;
}

@tskamath

Copy link
Copy Markdown

update the permalinks, for the change to reflect the new slug

@svenjanser

Copy link
Copy Markdown

Still works like a charm, thank you!

@adamcollingburn

Copy link
Copy Markdown

Doesn't seem to work anymore

(WooCommerce Product Vendors 2.1.17)

@hlashbrooke

Copy link
Copy Markdown
Author

This wouldn't have worked since v2.0 of Product Vendors when the codebase was largely refactored.

@adamcollingburn

Copy link
Copy Markdown

@hlashbrooke - Dang!

@Betialai

Betialai commented Sep 17, 2020 •

Copy link
Copy Markdown

Oddly enough, this is the same change suggested in the official WooCommerce documentation.
A workaround I've used is to change the language to en_CA, then modify the .po file to reflect the necessary changes, leaving the rest of lines untouched. You then select English (Canada) as the language for the WooCommerce site and it will show the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment