$
$arg = array(
\'post_type\' => \'plusnagarmitra\',
\'posts_per_page\' => \'10\',
\'tax_query\' => array(array(
\'taxonomy\' => category,
\'terms\' => 14
) ),
\'post_status\' => array(
\'publish\',
\'pending\',
\'draft\',
\'private\',
)
) ;
$loop = new WP_QUERY($arg);
?>
<div id="users">
<input class="search" placeholder="Search" />
<button class="sort" data-sort="name">
Sort by name
</button>
<button class="sort" data-sort="mobile">
Sort by Mobile
</button>
<table id="postTable" >
<thead>
<tr>
<th>Name</th><th>ID</th><th>Mobile</th><th>Address</th><th>SEX</th>
</tr>
</thead>
<tbody class="list">
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<tr>
<td class="name"><?php the_title( \'<p class="entry-title"><a href="\' . get_permalink() . \'" title="\' . the_title_attribute( \'echo=0\' ) . \'" rel="bookmark">\', \'</a></p>\' ); ?></td>
<td class"ID"><?php echo get_field(\'nm_id\'); ?></td>
<td class="mobile"><?php echo get_field(\'durbash_mobile_no\'); ?></td>
<td class="address"><?php echo get_field(\'stayi_pata\'); ?></td>
<td class="sex"><?php echo get_field(\'ling\'); ?></td>
<td><?php echo get_post_status( get_the_ID() ) ?></td>
<td class="sex"> <a href="<?php the_permalink()?>">✍ EDIT</a> </td>
</tr>
<?php endwhile; ?>
</tbody>
</tbody>
</table>
$
SO网友:Jacob Peattie
您缺少引号category
作为查询中的分类:
\'taxonomy\' => category,
需要是
\'taxonomy\' => \'category\',
因此,分类查询如下所示
\'tax_query\' => array(
array(
\'taxonomy\' => \'category\',
\'terms\' => 14
)
),