• I found a bug that I’m not sure if it’s always been there or just showed up in 2.8. When you see the list of posts on your blog homepage it’s fine, but when you click to page 2,3,4, etc of the listings, the PHP code is exposed and not executed. When you click through to the actual post, it’s fine.

    This is also a potential security risk.

    http://wordpress.org/extend/plugins/exec-php/

Viewing 6 replies - 1 through 6 (of 6 total)
  • I had the same problem. This seems to be caused by one of WordPress’ native functions force_balance_tags. This function worked before as well on the content of your blog but for some reason exec-php executed before this filter. In any case, the way I resolved it is I added these lines to exec-php file /include/runtime.php function filter_user_content($content).

    if(strpos($content,'< ?php ')!==FALSE)
    	{
    		$content=str_replace('< ?php','<?php',$content);
    	}

    Now it executes the code properly. The problem with this approach is that once you upgrade exec-PHP and they do not include this fix or provide another one for this particular problem you will again have this nasty bug. I resolved this by making a small plugin of my own called my-fixes.php. Put it in the plugins folder. and has this code in it:

    add_filter('the_content', 'my_filter_php_tag', 0); //fix for exec-php plugin and wordpress 2.8 and messed up php tag
    
    function my_filter_php_tag($content)
    {
    	if(strpos($content,'< ?php ')!==FALSE)
    	{
    		$content=str_replace('< ?php','<?php',$content);
    	}
    	return $content;
    }

    Hope this helps…

    This worked for me, many thanks mmorpglife.

    This was only happeningon one of my blogs – the other 2 were fine. Settings were the same too. Odd how these things happen!

    AWESOME! The fix worked for me perfectly! I’m using you fix at http://TheN2S.com

    Here was my problem: http://wordpress.org/support/topic/333634?replies=1

    This is an issue introduced with WordPress 2.8. See http://core.trac.wordpress.org/ticket/10248

    On my home page this will fix a simple < ?php echo "Hello World"; ?> but it makes a complete mess with < ?php include ('http://ibooktravel.com.au/wp-content/plugins/front-slider/front-slider.php');?> filling the page with errors…. Without the code
    if(strpos($content,'< ?php ')!==FALSE) {$content=str_replace('< ?php','<?php',$content); }
    I get the php displaying as a string on both home page and posts. Can anyone help ?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Exec-PHP] Shows PHP Code on Non-Homepage Post Listings’ is closed to new replies.