extract() is regarded as a “terrible function” by WordPress coding standards; please do not use. list() is similar to extract(), and is much more readable.
To update examples and avoid spread of set_query_var() in recents projects.
Lot of them continue to use set_query_var() for passing args/vars to a template with get_template_part().
Since WordPress 5.5 (08/11/2020), think to use the $args third parameter to passed args to a template or a partial.
One use case for this is to pass variable to template file when calling it with
get_template_part().Now in you template you can then call it.
This is a way to pass variables to the called files.
On the a.php file:
On the b.php file:
On the c.php file:
extract()is regarded as a “terrible function” by WordPress coding standards; please do not use.list()is similar toextract(), and is much more readable.To update examples and avoid spread of
set_query_var()in recents projects.Lot of them continue to use
set_query_var()for passing args/vars to a template withget_template_part().Since WordPress 5.5 (08/11/2020), think to use the $args third parameter to passed args to a template or a partial.
Doc about passing arguments to template files :
https://make.wordpress.org/core/2020/07/17/passing-arguments-to-template-files-in-wordpress-5-5/