Sunday, 11 October 2015

Enable PHP in Widget Without Plugin - WordPress



/* * ****************** add php support ****************** */

add_filter('widget_text', 'enable_php_code', 99);

function enable_php_code($text) {
    if (strpos($text, '<' . '?') !== false) {
        ob_start();
        eval('?' . '>' . $text);
        $text = ob_get_contents();
        ob_end_clean();
    }
    return $text;
}


No comments:

Post a Comment