Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function custom_product_permalink($permalink, $post) {
- // Check if the post is a product and has the product post type
- if (is_object($post) && $post->post_type === 'product') {
- // Build the custom permalink
- $permalink = add_query_arg( 'product_id', $post->ID, $permalink );
- }
- return $permalink;
- }
- add_filter('post_type_link', 'custom_product_permalink', 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement