Hi, I am using HTML widgets for PHP and this worked as a charm so far but since the last Newsletter Update it shows me errors in my code and it doesn’t let me save the widget.
Is there a way to disable this in Newspaper Theme pls? I know my code is ok!
-
This topic was modified 8 years by
eklisiarh.
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);
}
?>
My problem is: Since the last theme update I cannot save this code in HTML widget anymore because there are errors (which are not errors but PHP code).
So where I already saved this code everything works well but I cant save any new code because system doesn’t let me to do this. Here is screenshot:

Since widgets are theme related I presume you changed something so that I cant save this. Can this be disabled and how?
Ok I solved this myself or to be precise: This is not a problem caused by Newspaper Theme but a new thing in WordPress 4.9. They decided to implement new code-checker which prevents any code with “errors” to be saved in widgets…
Anyway solution is installing Enhanced Text Widget, if someone else reads this.
-
This reply was modified 8 years by
eklisiarh.