в Wp3 перестала работать конструкция

Есть функция в шаблоне, отвечающая за вывод последних комментов по заданному шаблону:

function u_get_recent_comments($no_comments = 5, $before = '<li>', $after = '</li>', $show_pass_post = false) { 

    global $wpdb, $tablecomments, $tableposts; 
    $request = "SELECT ID, comment_ID, comment_content, comment_author FROM $tableposts, $tablecomments WHERE $tableposts.ID=$tablecomments.comment_post_ID AND (post_status = 'publish' OR post_status = 'static')"; 

if(!$show_pass_post) { $request .= "AND post_password ='' "; } 

    $request .= "AND comment_approved = '1' ORDER BY $tablecomments.comment_date DESC LIMIT  

$no_comments"; 
    $comments = $wpdb->get_results($request); 
    $output = ''; 
    foreach ($comments as $comment) { 
       $comment_author = stripslashes($comment->comment_author); 
       $comment_content = strip_tags($comment->comment_content); 
       $comment_content = stripslashes($comment_content); 
       $comment_excerpt =substr($comment_content,0,50); 
       $comment_excerpt = u_utf8_trim($comment_excerpt); 
       $permalink = get_permalink($comment->ID)."#comment-".$comment->comment_ID; 
       $output .= $before . '<a href="' . $permalink . '" title="View the entire comment by ' . $comment_author . '"><strong>' . $comment_author . '</strong>: ' . $comment_excerpt . '...</a>' . $after; 
       } 
       echo $output; 
}

которая выводится в нужном месте конструкцией

<?php  u_get_recent_comments(6);      ?>

после обновления до версии 3.0 функция ничерта не выводит, просто пустое место без всяких ошибок. структура таблиц в свежей версии вроде не менялась, в чем же тогда может быть косячок?

Я бы первым делом проверил сомнительные глобальные переменные $tablecomments и $tableposts. Обычно используют $wpdb->comments и $wpdb->posts.

Anonymous
Отправить
Ответ на: