Created
May 2, 2022 14:31
-
-
Save taricco/dd7808befac9be64d25e4f858e7ace57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** 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