我刚刚将我主持的一个博客升级为WordPress 3.9.1。在那个博客上,我使用拼凑主题。在那之后,博客就停止工作了。我看不到任何服务器端PHP错误-这可能是由于我的日志配置错误。在浏览器端,我可以看到我正在使用Chrome的开发工具获得HTTP 500。
我最终意识到这个问题来自于拼凑主题中的这个方法。
function patchwork_posted_on() {
printf( __( 'Posted on <a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a><span class="byline"> by <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'patchwork' ),
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'patchwork' ), get_the_author() ) ),
esc_html( get_the_author() )
);
}我已经有一段时间没有做很多PHP了,所以我很难了解它到底有什么问题。考虑到它与Wordpress 3.9.0一起工作,并且不再起作用,我想说这里的一种方法已经被废弃了。
有谁有主意吗?
编辑
我没有写这个主题,而且它已经很长时间没有更新了,所以这个问题必须来自wordpress中的一个改变,它破坏了主题,或者是在另一个插件中,我可以更新。
另外,我得到的错误是,文章页面的生成一直到标题,然后当它即将打印在.通过..。它就会死。事实上,这就是促使我调查当时所呼吁的任何事情的原因。
谢谢。
发布于 2014-07-13 14:27:46
据我所知,是get_the_date()造成了这个问题。我仍然可以在wordpress找到描述它的页面,但它不在功能指标中。
我更新了我的代码,使其只使用get_the_time:
echo __('<!--:en-->By <!--:--><!--:fr-->Par <!--:-->'.'<a class="url fn n" href="'.esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ).'" title="Voir tous les articles de '.esc_html( get_the_author() ).'" rel="author">'.esc_html( get_the_author() ).'</a><!--:en--> on '.get_the_time('F j, Y').'<!--:--><!--:fr--> le '.get_the_time('j F Y').'<!--:-->' );顺便说一句,从那以后,我在另一个博客上出现了这个问题--在同一个PHP服务器上单独使用wordpress。
发布于 2014-06-05 03:20:04
您可能达到了PHP内存限制。
patchwork_posted_on()函数没有什么问题,它不使用任何不推荐的方法。
https://stackoverflow.com/questions/23920214
复制相似问题