WordPress 4.4 stops PHP executing in text widgets
-
As soon as I updated, the conditional PHP code I was using (succesfully) to show/hide certain images on certain posts/pages stopped working.
When I load my site all I see is the PHP code printed in plain text.
Here’s what I have in functions.php –
// Enable PHP in widgets 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; }
Here’s the PHP I was using in the text widgets
<?php if ( ( is_page( 1150 ) || is_page( 4798 ) || is_page(1538) || is_page(1535) ) ) { ?> <a href="/genesis/"><img src="https://localhost/smallbizgeeklocal/wp-content/uploads/2014/images/728X90.png" alt="Genesis Framework Banner" title="My thoughts on the WordPress Genesis Framework by StudioPress"></a> <?php }
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘WordPress 4.4 stops PHP executing in text widgets’ is closed to new replies.