wordpress 500错误

Standard

前天在修改了一遍文章的tag后整个wordpress就打不开了,报500错误.
刚才在网上无意间看到了解决方法.哎,早点看到就不至于这么折腾了.很奇怪这个问题之前我在google上居然没查到-_-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
// includes/wp-db.php
function prepare($args=NULL) {
    if ( NULL === $args )
        return;
    $args = func_get_args();
    $query = array_shift($args);
    $query = str_replace("'%s'", '%s', $query); // in case someone mistakenly already singlequoted it
    $query = str_replace('"%s"', '%s', $query); // doublequote unquoting
    $query = str_replace('%s', "'%s'", $query); // quote the strings
    array_walk($args, array(&$this, 'escape_by_ref'));
    // 注释掉原来的return
    // return @vsprintf($query, $args);
    // 新的方法只针对重复标题时的死循环问题
    $reg = "#post_name = '((?:%[0-9a-f]{2})+.+)'#Usi";
    if (preg_match($reg, $query, $match)) {
        $he = $match[1];
        $hd = urldecode($he);
        $query = str_replace($he, $hd, $query);
        $query = @vsprintf($query, $args);
        $query = str_replace($hd, $he, $query);
    } else {
        $query = @vsprintf($query, $args);
    }
    return $query;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.