Posted on

No Plugins: Php in Widgets + Use WP Classic Editor

If you want to use as little plugins as possible to prevent possible hacks/etc, you can disable 2 plugins by using the following codes. Add them into your Functions.php file of your wordpress theme and enjoy.

PHP in Widgets

add_filter('widget_text','php_in_widgets',100);
function php_in_widgets($html){
     if(strpos($html,"<"."?php")!==false){
          ob_start();
          eval("?".">".$html);
          $html=ob_get_contents();
          ob_end_clean();
     }
     return $html;
}

add_filter( 'widget_text', 'do_shortcode' );

Classic WP Editor

add_filter("use_block_editor_for_post_type", "disable_gutenberg_editor");
function disable_gutenberg_editor()
{
return false;
}