jrobinsonc
8/31/2015 - 11:24 PM

Wordpress filter: Execute PHP from widgets.

Wordpress filter: Execute PHP from widgets.

<?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);