Skip to main content
// you can use any value including objects.

set_query_var( 'var_name_to be used_later''var_name_to_be_used_later', 'Value to be retrieved later' );
//Basically set_query_var uses PHP extract() function  to do the magic.


then later in the template.
var_dump($var_name_to be used_later$var_name_to_be_used_later);
//will print "Value to be retrieved later"

I recommend to read about PHP Extract() function.

// you can use any value including objects.

set_query_var( 'var_name_to be used_later', 'Value to be retrieved later' );
//Basically set_query_var uses PHP extract() function  to do the magic.


then later in the template.
var_dump($var_name_to be used_later);
//will print "Value to be retrieved later"

I recommend to read about PHP Extract() function.

// you can use any value including objects.

set_query_var( 'var_name_to_be_used_later', 'Value to be retrieved later' );
//Basically set_query_var uses PHP extract() function  to do the magic.


then later in the template.
var_dump($var_name_to_be_used_later);
//will print "Value to be retrieved later"

I recommend to read about PHP Extract() function.

Source Link
Hugo R
  • 211
  • 2
  • 2

// you can use any value including objects.

set_query_var( 'var_name_to be used_later', 'Value to be retrieved later' );
//Basically set_query_var uses PHP extract() function  to do the magic.


then later in the template.
var_dump($var_name_to be used_later);
//will print "Value to be retrieved later"

I recommend to read about PHP Extract() function.