Add variables in Wordpress SLUG

Asked

Viewed 33 times

0

I’m trying to add variables to Slug Wordpress, I succeeded by adding in the following way:

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 you 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 );

However when I update the post the variable does not update the value to 1544, the same test is maintained

  • Welcome to Stackoverflow, what’s the problem? the variable is not being updated? is it giving error? This is not very clear.

  • I need to update the value of the variable that this stay in the page url whenever you update the post but it does not work. The value lies always the same

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.