Skip to content

Instantly share code, notes, and snippets.

@BeyondTheLoop
Last active October 10, 2018 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BeyondTheLoop/0d1f7d99fdef1f3f9785c798f8a486f6 to your computer and use it in GitHub Desktop.
Save BeyondTheLoop/0d1f7d99fdef1f3f9785c798f8a486f6 to your computer and use it in GitHub Desktop.
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