在过去的几天里,当我做某些事情时,我的WordPress安装一直挂起,包括:
等等 - 如此清楚 - 这是一个更广泛的问题。
当然,我咨询了网站错误日志,其中包含:
[22-Jan-2018 15:57:54 UTC] PHP Warning: Illegal string offset 'width' in /home/ptrcao/public_html/wp-content/themes/independent-publisher/image.php on line 26
[22-Jan-2018 15:57:54 UTC] PHP Warning: Illegal string offset 'height' in /home/ptrcao/public_html/wp-content/themes/independent-publisher/image.php on line 27
image.php的第26行和第27行对应于下面显示的上下文中的$metadata['width']
和$metadata['height']
:
<?php
$metadata = wp_get_attachment_metadata();
printf(
__( '"%1$s" - <a href="%2$s" title="Link to full-size image">%3$s × %4$s</a> %5$s <a href="%6$s" title="Return to %7$s" rel="gallery">%7$s</a>', 'independent-publisher' ),
get_the_title(),
wp_get_attachment_url(),
$metadata['width'],
$metadata['height'],
independent_publisher_entry_meta_category_prefix(),
get_permalink( $post->post_parent ),
get_the_title( $post->post_parent )
);
?>
任何人都可以对解决方案有所了解吗?