Skip to content

Instantly share code, notes, and snippets.

@dgoze
Created July 24, 2024 18:05
Show Gist options
  • Save dgoze/e8bc84c2ac41642e96547cb12a74b736 to your computer and use it in GitHub Desktop.
Save dgoze/e8bc84c2ac41642e96547cb12a74b736 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