Created
August 31, 2015 23:24
-
-
Save jrobinsonc/0b2f8aed9b97314d2b5f to your computer and use it in GitHub Desktop.
Wordpress filter: Execute PHP from widgets.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Execute PHP from widgets. | |
*/ | |
add_filter('widget_text', function ($html){ | |
if(strpos($html, "<"."?php") !== false) | |
{ | |
ob_start(); | |
eval("?".">".$html); | |
$html = ob_get_contents(); | |
ob_end_clean(); | |
} | |
return $html; | |
}, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment