Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Executing PHP code in WordPress text widget
/**
*
* Executing PHP code in WordPress text widget
*
*/
function execute_php($html){
if(strpos($html,"<"."?php")!==false){
ob_start();
eval("?".">".$html);
$html=ob_get_contents();
ob_end_clean();
}
return $html;
}
add_filter('widget_text','execute_php',100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.