It’s just [link to= "https://wordpress.stackexchange.com/"]
.
This is a textbook example of why extract()
is bad. You can’t easily tell where variables are coming from. extract()
creates variables out of an array with the keys becoming the variable name. So this part:
extract(shortcode_atts(array(
"to" => 'http://net.tutsplus.com'
), $atts));
Is creating an array with a to
key, set to http://net.tutsplus.com
if it’s not defined in $atts
. Then it’s extract()
ed so that the to
key becomes $to
.
You should avoid using extract()
and just use the $atts
variable:
function link($atts, $content = null) {
$atts = shortcode_atts(array(
"to" => 'http://net.tutsplus.com'
), $atts);
return '<a href="'.$atts['to'].'">'.$content.'</a>';
}