Created
March 21, 2018 16:19
-
-
Save adambradford/dc43c5d4ca050d2282c2de5e3dcdecb8 to your computer and use it in GitHub Desktop.
Allow the standard WordPress text widget to execute PHP
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 | |
//* Add this to your functions.php file. Do NOT include the opening php tag | |
//* Allow Standard WordPress Text widget to execute PHP | |
function php_execute($html){ | |
if(strpos($html,"<"."?php")!==false){ ob_start(); eval("?".">".$html); | |
$html=ob_get_contents(); | |
ob_end_clean(); | |
} | |
return $html; | |
} | |
add_filter('widget_text','php_execute',100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment