伙计们!我有以下问题需要解决-我正在使用私有内容插件,它将用户划分为不同的类别。我需要显示作者所属类别的所有帖子。我尝试添加一个自定义查询,经过测试,该查询返回受影响的正确行数,但我无法让它显示数组的元素(我已声明全局$wpdb):
if (!current_user_can(\'administrator\')) {
//$groupcat is something like this string \'a:1:{i:0;s:2:\\"23\\";}\';
$groupcat = $wpdb->get_results( "SELECT `categories` FROM 7NIaM6l_pc_users WHERE `wp_user_id` = 13", ARRAY_N);
//Here I count the results and display them in the browser\'s console for check, which works fine
$ac = count($groupcat);
echo \'<script>console.log("count \' . $ac . \' ")</script>\';
//This part doesn\'t work.
echo \'<script>console.log("First element: \' . groupcat[0] . \' ")</script>\';