Wordpress分类法代码在PHP 5.5中不起作用

时间:2016-01-25 12:54:06

标签: php mysql wordpress mysqli taxonomy

用于在PHP 5.4中工作的代码但在PHP 5.5中拒绝。无法在代码中找到错误。查看了迁移指南,但没有看到任何问题。感觉这与PHP 5.5中的mysql折旧有关,需要用mysqli替换。但是,mysql不直接在此PHP脚本中使用。

<?php global $wpdb;
$cterm = get_query_var(taxname(get_the_id()));
$taxonomyName = taxname(get_the_id());
$terms = get_terms($taxonomyName,array('parent' => 0));

foreach($terms as $term) {
  echo '<li>';
  echo '<a rel="'.$term->term_id.'" href="'.get_term_link($term->slug,$taxonomyName).'">'.$term->name.'</a>';

  $term_children = get_term_children($term->term_id,$taxonomyName);
  echo '<ul class="insertedList">';

  foreach($term_children as $term_child_id) {
     $term_child = get_term_by('id',$term_child_id,$taxonomyName);
     echo '<li><a rel="'.$term_child->term_id.'">' . $term_child->name . '</a></li>'; 
  } echo '</ul></li>';
} ?>

0 个答案:

没有答案