Wordpress wp_query和自定义字段

时间:2014-05-26 07:39:05

标签: wordpress wp-query meta-key

我有一个类别,其中帖子由此wp_query列出:

<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
    'post_type' => 'post',
    'stage' => 'process',
    'paged' => $paged,
);
$query = new WP_Query( $args );

使用插件m_snap(帖子的字母顺序)存在问题。它为任何带字母的帖子提供自定义字段。所以,URL变成这样:

[...]/category/product/letter/A/但与[...]/category/product/

没有区别

如何使用wp_query更正m_snap以获取正确的帖子列表?

UPD。发现重写网址有问题。这是来自插件的代码:

    function m_snap_generate_rewrite_rules($wp_rewrite) {
        $IIIIIIIII1ll = array (
            'letter/(.+)' => 'index.php?letter=' . $wp_rewrite->preg_index(1),
            'tag/(.+?)/letter/(.+)' => 'index.php?tag='.$wp_rewrite->preg_index(1).'&letter='.$wp_rewrite->preg_index(2),
            'category/(.+?)/letter/(.+)' => 'index.php?category_name='.$wp_rewrite->preg_index(1).'&letter='.$wp_rewrite->preg_index(2)
        );
        $wp_rewrite->rules = $IIIIIIIII1ll + $wp_rewrite->rules;
    }
...
add_action ( 'generate_rewrite_rules', 'm_snap_generate_rewrite_rules' );

要纠正哪些想法?

0 个答案:

没有答案