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.
Example:
[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.
Example:
<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;
}else{
$return = "";
}
return $return;
}