Add variables in SLUG WordPress

0

I'm trying to add variables in Wordpress's slug , I was successful adding it as follows:

function add_var_post( $url, $id ) {
            $url = add_query_arg( 'version', 'teste', $url );
            return $url;
}
add_filter( 'page_link', 'add_var_post', 10, 2 );

But I would like to change the value of the variable whenever I update the post as follows:

function check_values($post_ID, $post_after, $post_before){
$var = 'version'; //example
$value = 1544; //example
$result = set_query_var($var, $value); 
}
add_action( 'post_updated', 'check_values', 10, 3 );

But when I update the post the variable does not update the value to 1544, if it keeps the same test

    
asked by anonymous 19.10.2018 / 23:55

0 answers