Web Hosting
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Running PHP code from Text Widget in WordPress

Discussion in 'Misc WordPress Requests' started by pandraka, Dec 6, 2017.

  1. pandraka

    Guest

    Running PHP code from Text Widget in WordPress, by pandraka

    I’m using a child theme for twenty-twelve. I had added the following code that allowed me to add php code while using the text widget

    function php_execute($html){
    if(strpos($html,”<“.”?php”)!==false){ ob_start(); eval(“?”.”>”.$html);
    $html=ob_get_contents();
    ob_end_clean();
    }
    return $html;
    }
    add_filter(‘widget_text’,’php_execute’,100);

    This worked fine until the latest release, now there is an editor telling me I can’t save the code until I use escape codes for the < and > brackets. If I do that the code doesn’t work. How do I shut down the editor so I can use the php override?

    Running PHP code from Text Widget in WordPress
     
    #1

Share This Page

Web Hosting