我這樣設定的變量在我的網站:PHP錯誤get_terms
$args = array('parent' => 2818,'hide_empty' => false);
$best_of_cat_child_terms = get_terms($args); -> (functions.php:26)
$best_of_cat = $best_of_cat_child_terms;
的問題是,我也越來越這個PHP錯誤:
警告:
Invalid argument supplied for foreach()
地點:
wp-includes/class-wp-term-query.php:373
調用堆棧:
WP_Term_Query->get_terms()
wp-includes/class-wp-term-query.php:287
WP_Term_Query->query()
wp-includes/taxonomy.php:1217
get_terms()
wp-content/themes/theme-child/functions.php:26 (-> functions.php line 26 marked above)
難道我設置這個正確的方式?
什麼WP版本? –
@cale_b版本4.6.1 – Alex