Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wsa_change_link_for_auction( $url, $post ) {
- if ( 'product' == get_post_type( $post ) ) {
- $product = wc_get_product($post);
- if($product->product_type === 'auction'){
- $url = str_replace('product', 'auction', $url);
- }
- }
- return $url;
- }
- add_filter( 'post_type_link', 'wsa_change_link_for_auction', 10, 2 );
- function wsa_custom_rewrite_for_auction() {
- add_rewrite_rule('auction/([^/]+)(?:/([0-9]+))?/?$', 'index.php?product=$matches[1]&page=$matches[2]', 'top');
- }
- add_action('init', 'wsa_custom_rewrite_for_auction');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement