• My WP version = 5.1.1
    My PHP version = 5.2.4

    This isn’t really an exec-php problem. PHP opening tags are getting munged.

    A recent update to WordPress caused this problem – not sure which version.

    In a multi-post page view of posts that include the <!–more–> tag, the opening tag for PHP was getting corrupted with an added space between < and ?php. If you viewed the offending post by itself, the error would go away.

    There’s probably a more elegant way to fix this, but here’s my solution:

    Edit: wp-includes/formatting.php file
    After line 2558: $newtext = str_replace( ‘< !–‘, ‘< !–‘, $newtext );
    Add: $newtext = str_replace(‘< ?php’,'<?php’,$newtext);

    • This topic was modified 6 years, 9 months ago by Imageclickfaster.

The topic ‘Exec-PHP error: <?php becomes < ?php’ is closed to new replies.