开发者

Why does this line of script crash apache?

Here's the branch of code I've isolated...

if ( !is_search() 
    && (g开发者_运维知识库et_option('option1') 
        && !(is_page() 
            || get_option('option2') 
                || get_option('option3') 
                    || in_category('excludeme', $post )
            )
        )
    )

I've inserted...

<?php print "Hi, Mom!\n"; exit; ?> 

above and below this line to isolate the cause of the crash


Try breaking out your code into chunks to further isolate the problem: This is obviously a WordPress template, and even though you may think the problem is not in the core WordPress code, you may need to put debugging output inside the core functions to find out exactly where the problem is happening. In other words, you need to go inside these functions calls to find out what is causing the problem - you might find a solution to your problem at that point.

<?php
echo '<pre>';

echo PHP_EOL . 'is_search' . PHP_EOL;
var_dump( is_search() );

echo PHP_EOL . 'get option 1' . PHP_EOL;
var_dump( get_option('option1') );

echo PHP_EOL . 'is_page' . PHP_EOL;
var_dump( is_page() );

echo PHP_EOL . 'get option 2' . PHP_EOL;
var_dump( get_option('option2') );

echo PHP_EOL . 'get option 3' . PHP_EOL;
var_dump( get_option('option3') );

echo PHP_EOL . 'in category' . PHP_EOL;
var_dump( in_category('excludeme', $post ) );
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜