【发布时间】:2014-10-09 13:09:18
【问题描述】:
我有一个奇怪的问题,有些帖子出现在它们不属于的类别中。 当我查看我的后台并按类别过滤时,那里会出现一些帖子,但它们没有被签入。
结果是他们也出现在前台。
这是我的 category.php(但我不认为这是问题)
<?php
get_header();
?>
<section id="wrapper" class="page <?php echo get_query_var('cat'); ?>">
<div id="container">
<?php
$category = get_category(get_query_var('cat'));
$cat_id = $category->cat_ID;
query_posts('showposts=1&cat='.$cat_id);
if ( have_posts() ) :
while ( have_posts() ) : the_post();
get_template_part( 'content', get_post_format() );
endwhile;
endif;
?>
</div>
</section>
<?php
get_footer();
?>
我查看了“_term_relationships”表,一切正常,它们没有属于错误的类别。
所以也许有人有线索可以找出答案?
PS : 我使用的是 WPML,但如果我停用它,也是同样的问题
【问题讨论】:
-
删除您的自定义查询,使用主循环。也永远不要使用
query_posts,它只是用于创建自定义查询的一个非常糟糕的功能。 -
你的意思是我在后台的自定义 jquery 吗?因为我不使用一个
标签: php mysql wordpress categories wpml