Add ?piura final url of products generated

by Eduardo Rafael   Last Updated October 19, 2019 13:08 PM - source

I need to add via the functions.php at the end of the parameter ?Piura. Since I am using this code so that all users who have the ?Piura parameter have a special code.

The problem is that the url generated from the products do not carry the source parameter and this parameter is lost.

How would you do that also when you enter with the pararetro

www.example/prodcucto/cup?piura

The url generated from other products also have the parameter ?Piura

My code:

if(isset($_GET['piura'])) {
add_action('init', 'dcms_page_permalink', 0);
function dcms_page_permalink() {
    global $wp_rewrite;

    if ( !strpos($wp_rewrite->get_page_permastruct(), '?piura')){
        $wp_rewrite->page_structure = $wp_rewrite->page_structure . '?piura';
    }
}

Not work :( }

Tags : woocommerce urls


Related Questions


append special url end of my website urls

Updated February 01, 2017 14:03 PM


My WooCommerce Shop has 2 URLs

Updated March 26, 2018 19:08 PM