Execute PHP In WordPress Without Using Any Plugin
Some people would want to execute PHP codes in WordPress’ default text widget but this is not possible since it does not support such a task. There are, however, a number of plugins available that you can use to do this.
But thanks to Marvie Pons of TriptripperTips who shared this helpful snippet of code, you won’t have to install and use any plugins anymore. Just copy/paste and add the code below into your functions.php file.
add_filter('widget_text','execute_php',100); function execute_php($html){ if(strpos($html,"<"."?php")!==false){ ob_start(); eval("?".">".$html); $html=ob_get_contents(); ob_end_clean(); } return $html; }
What the code does is turn the default Text widget into a PHP-enabled widget. Once you’ve edited and saved your functions.php file, you’re done!
Incoming search terms for the article:
- wordpress execute php without plugin
- how to execute php in wordpress without plugin
- add_filter(\widget_text\ \execute_php\ 100);
- how to run flash in wordpress without using any plugin
- how we execute php in text editer in wordpress without plugin
- intitle:PHP Development CommentLuv
- php in wordpress without plugin
- run php code in wordpress without plugin
- run php in wordpress no plugin
- using wordpress to run php no plugin
1 Comment
Salma
08.23.2012
How do you add php code in pages without using plugins?
There are no trackbacks to display at this time.