我正在使用Wordpress 3.0.1,我制作了一个名为'dienasgramatas'的自定义帖子类型。我的插件还制作自定义重写规则,用于显示此帖子类型的所有帖子,甚至是自定义永久链接结构,用于查询来自定义作者的此帖子类型的帖子。但我无法创建分页规则:
一条有效的规则:
$new_rules['dienasgramatas' . '/([^/]+)/?$'] = 'index.php?post_type=dienasgramata&author_name=' . $wp_rewrite->preg_index(1);
它给出了这个重写规则:
[dienasgramatas/([0-9]{4})/?$] => index.php?post_type=dienasgramata&year=$matches[1]
但是这个规则:
$new_rules['dienasgramatas' . '/([^/]+)/page/?([0-9]{1,})/?$'] = 'index.php?post_type=dienasgramata&author_name=' . $wp_rewrite->preg_index(1) . '&paged=' . $wp_rewrite->preg_index(2);
输出这个(错误的)重写规则:
[dienasgramatas/([^/]+)/page/?([0-9]{1,})/?$] => index.php?dienasgramata=$matches[1]&paged=$matches[2]
如您所见,post_type被忽略,此重写规则无法正常工作。
有人可以告诉我为什么它不起作用,或者如何使它正确?