A while back I wrote a shortcode for my site, and it just recently stopped working. I'm wondering if someone can help.

The shortcode is called paramtext. What it does is check the value of a certain parameter in the page url, and if it meets the criteria, wordpress displays whatever is within the shortcode.


[paramtext param="hi" val="yes"]hello![/paramtext]

This would say "hello!" only if the url had ?hi=yes in it.

The shortcode works fine, except for in one type of situation. That is if its within the href of a link.


<a href="http://website.com/[paramtext param="abc" val="xyz"]pagename[/paramtext]" target="_blank">link</a>

It used to work just find (in this case, the link would be http://website.com/pagename or just http://website.com), but recently it stopped. Now, no matter what the parameter is in the url, the link it gives is http://website.com/[paramtext param=. It doesn't realize that the shortcode is actually a shortcode.

I tried deactivating all plugins, and also changing the theme to twentyfourteen, but nothing helped. Maybe it's a wordpress update that killed it?

Here's my shortcode - if anyone can advise how to fix it, I'd really appreciate it!

function paramtext( $atts, $content = null ) {  
extract( shortcode_atts( array(
    'param' => 'param',
    'val' => 'val',
    'hide' => false,
), $atts ) );
if ((strtolower($_GET[$param]) == strtolower($val) && $hide == false)||(strtolower($_GET[$param]) != strtolower($val) && $hide == true)){
    $return = $content;  
    $return = "";
return $return;


  • PS: If any more info or clarification is needed please let me know!
    – user3515
    Commented Aug 17, 2015 at 16:34

1 Answer 1


WordPress 4.2.3 made some changes to the way shortcodes work in order to fix a security issue. See here: https://make.wordpress.org/core/2015/07/23/changes-to-the-shortcode-api/

This is most likely the cause of your problem. See the Shortcodes with Bad Quotes section, and the accompanying workaround suggestion.

  • Wow! What an easy fix, after spending hours debugging :). I changed the double quotes within the shortcode to single quotes, and whew - it works! I can't thank you enough!!!!
    – user3515
    Commented Aug 17, 2015 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.