0

i want to add custom part at the end of permalink

like this

https://example.com/product/product-name/order

i want

https://example.com/product/product-name?order=1

redirect to

https://example.com/product/product-name/order

thanks for all

0

You need to put this code into your product single page before get_header() function start.

<?php
global $wp;
if( isset($_SERVER['QUERY_STRING']) && isset($_GET['order']) ){
    $url = home_url( $wp->request . '/order/' );
    wp_safe_redirect( $url );
    exit;
}
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.