Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taricco/dd7808befac9be64d25e4f858e7ace57 to your computer and use it in GitHub Desktop.
Save taricco/dd7808befac9be64d25e4f858e7ace57 to your computer and use it in GitHub Desktop.
/** Shortcode to display URL parameter
Shortcode: [URLVar param='firstname']
Plugin: https://www.warrenchandler.com/2021/09/11/wordpress-shortcode-to-get-text-from-url-vars-parameters/
–––––––––––––––––––––––––––––––––––––––––––––––––– **/
function wsv_show_url_variable($atts)
{
extract(
shortcode_atts(
array(
'param' => 'param'
),
$atts
)
);
return stripslashes(esc_attr(esc_html($_GET[$param])));
}
add_shortcode('URLVar', 'wsv_show_url_variable');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment