since I am new to wordpress plugin development I am trying create a shortcode based plugin. I am trying to run the php code enclosed in the shortcode. The shortcode is working fine but the eval() that I use in shortcode handler is throwing some parse error:
Parse error: syntax error, unexpected ‘&’ in XXXXX.php(32) : eval()’d code on line 1
shortcode handler:
if(is_null($content)){
return " ";
}else{
ob_start();
eval($content);
$evaluated_content = ob_get_contents();
ob_end_flush();
return $evaluated_content;
}
shortcode usage:
[shortcode]echo 'hello';[/shortcode]
Please help me out.
Update: there is no problem in the code i find thats why i am asking this question i have already gone through the previously answered questions but there no such error in my code i'm simply echoing hello. and one more thing if i pass the same code as a string to eval() directly then it works fine but when the string is coming from shortcode then it gives the parse error