WP custom post types pagination/404 error
I’m using a custom post type in WordPress (called “ns_news_article” generated from Magic Fields) which are registered and working. This rewrites the URL to add “category/news” after the domain (so: http://www.mydomain.com/category/news/custom-post-1). I have to have the “fake directories” in there.
I have this in the functions.php:
add_rewrite_rule("[ns_news_article]" . '$', "index.php?pagename=[ns_news_article]", "top"); add_rewrite_rule("[ns_news_article]" . '/page/([0-9])*/?', "index.php?pagename=[ns_news_article]" . '&paged=$matches', "top"); global $wp_rewrite; $wp_rewrite->flush_rules();
The 2nd line takes care of pagination 404 problem when viewing as multiple pages of lists, but then gives 404 errors when trying to view the single post. If I get rid of this, you can view the posts, but pagination doesn’t work.
Can I fix this or should it be done another way?
- The topic ‘WP custom post types pagination/404 error’ is closed to new replies.