Skip to content

Instantly share code, notes, and snippets.

@zackpyle
Created May 16, 2023 12:56
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 zackpyle/56137d0ccde0b62385397cbf61fa0991 to your computer and use it in GitHub Desktop.
Save zackpyle/56137d0ccde0b62385397cbf61fa0991 to your computer and use it in GitHub Desktop.
Use the [URLParam param='paramName'] shortcode to display GET parameters from the current URL
<?php // ignore this line - only for formatting
// Use the [URLParam param='paramName'] shortcode to display GET parameters from the current URL
function displayURLparam( $atts ) {
extract( shortcode_atts( array(
'param' => 'param',
), $atts ) );
return esc_attr(esc_html($_GET[$param]));
}
add_shortcode('URLParam', 'displayURLparam');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment