I am using WordPress and for some reasons I need to execute php in my WordPress text widgets. I googled and found this code to add in functions.php file:
add_filter('widget_text', 'php_text', 99);
function php_text($text) {
if (strpos($text, '<' . '?') !== false) {
ob_start();
eval('?' . '>' . $text);
$text = ob_get_contents();
ob_end_clean();
}
return $text;
}
It uses eval() but I dont want to use it as it's a dangerous function and my hosting has this function disabled. What can be the best alternative in my case?
Please don't report is as duplicate, other questions for this topic aren't helping me and it's related to WP
Aucun commentaire:
Enregistrer un commentaire