【发布时间】:2021-01-18 06:38:45
【问题描述】:
我在我的 Wordpress 循环中收到了这 2 个 PHP 通知,我进行了全面研究,但我不知道如何解决这个问题。该脚本按预期工作,但通知出现在整个页面上。
注意:\wp-includes\taxonomy.php 第 3442 行中的数组到字符串的转换
注意:\wp-includes\category-template.php 第 1279 行中的数组到字符串的转换
我已经搜索了互联网,我认为这可能是导致问题的代码,但我无法弄清楚是什么破坏了它,无论我尝试什么,我似乎都无法修复它。请有人帮我解决这个问题并向我解释这个问题。
<?php
if ( $the_query->have_posts() ) :
$i=1;
// Start the Loop
while ( $the_query->have_posts() ) : $the_query->the_post();
?>
<?php
$terms = get_the_terms( $post->ID, array('date-category', 'programme-category') );
if ( $terms && ! is_wp_error( $terms ) ) :
$catTag = array();
foreach ( $terms as $term ) {
$catTag[] = $term->slug;
}
$catTag = implode(" ", $catTag );
?>
【问题讨论】:
标签: php wordpress loops while-loop