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 HTML check option in WordPress 4.9

Discussion in 'Misc WordPress Requests' started by eklisiarh1, Nov 21, 2017.

  1. eklisiarh1

    Guest

    HTML check option in WordPress 4.9, by eklisiarh1

    I find the new code-check function in WordPress to be helpful but I think you went one step too far, when you decided not to allow us to save our code if it has errors. One can do this only if one is sure that their code-check is able to recognise all cases of custom code from errors and we will all agree that this will not be possible any soon (maybe when AI comes?).

    Here is one such case:

    In the custom HTML widget I use PHP to fill the info from the forms. Here is what I do:

    I add following code to the functions.php:

    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;
    }

    Than I use Advanced Custom Fields plugin to gather data in forms and I add these to HTML widget with this code:

    <?php global $wp_query;
    if(is_object($wp_query->queried_object) && $wp_query->queried_object->ID)
    {
    echo get_post_meta($wp_query->queried_object->ID, 'gtelefonnummer', true);
    }
    ?>

    Since the last theme update I cannot save this widget because your code-check engine finds errors in my HTML which are actually no errors but PHP!

    All the old widgets containing that code work perfectly but I cannot add any new code to the widgets for new fields!

    How can I disable this?

    HTML check option in WordPress 4.9
     
    #1

Share This Page

Web Hosting