PHP error
-
Nice little plugin, but it generates a PHP error if you have error reporting enabled in your wp-config file. The error is an undefined index, which occurs unless when you use the shortcode you include both “mail” and “mailto” arguments (with one of them blank.)
You can fix this easily enough by rewriting the plugin to use “isset” to check for the existence of each index before trying to reference it, like so:
[ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]
function wk_email_antibot_shortcode($args) { ob_start(); if (isset($args["mail"])) { echo antispambot($args["mail"]); } if (isset($args["mailto"])) { echo '<a>'.antispambot($args["mailto"]).'</a>'; } $output_string = ob_get_contents(); ob_end_clean(); return $output_string; }; add_shortcode('antibot', 'wk_email_antibot_shortcode');
- The topic ‘PHP error’ is closed to new replies.