wordpress custom post type rewrite rule pagination for author

I’m using WordPress 3.0.1 and I have made a custom post-type called ‘dienasgramatas’. My plugin also makes custom rewrite rules for displaying all posts from this post type, and even a custom permalink structure to query posts with this post type coming from a defined author. But I can’t create a rule for pagination:

The one rule that works:

Read More
$new_rules['dienasgramatas' . '/([^/]+)/?$'] = 'index.php?post_type=dienasgramata&author_name=' . $wp_rewrite->preg_index(1);

It gives this rewrite rule:

[dienasgramatas/([0-9]{4})/?$] => index.php?post_type=dienasgramata&year=$matches[1]

But this rule:

$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);

outputs this (faulty) rewrite rule:

[dienasgramatas/([^/]+)/page/?([0-9]{1,})/?$] => index.php?dienasgramata=$matches[1]&paged=$matches[2]

As you can see, post_type is ignored and this rewrite rule does not work as it should.

Can someone tell me why it’s not working, or how to make it right?

Related posts

Leave a Reply