Heeeeyyy, is anyone alive? No ideas for such problem?
Ok, I figured out that problem, that was slug conflict, although I still do not fully understand what exactly caused it. I had build in taxonomy with a slug similar to page slug and my post type slug had the same name. I changed post type slug and then removed taxonomy just in case, now pagination works fine.
Yes, i got the same error. But it is because of next & previous page url link.
In my case problem was not links. I have tried many different variations, nothing worked. So I finally corrected .htaccess. Now I want to understand why that thing could not work with WP mod rewrite
I have tried many different variations, nothing worked. So I finally corrected .htaccess.
How did you correct .htaccess, specifically?
I’ve seen issues like this crop up when slugs collide, definitely.
Well since that moment I did couple of other things, at first I changed name of post type to ‘pt-news’ with rewrite slug ‘news’ and deleted taxonomy ‘news’ and ‘category’. It worked for a while but then ended up not working. I still do not understand WP rewrite logic. So I had up to correct .htaccess finally.
I added following
RewriteRule ^news/((?!\d{1,3}/?$).+)/?$ /?pt-news=$1 [L,QSA,NC]
It excludes 1-3 numbers of pagination from links and make them work as planned, but if it sees slug of pt-news object it sends it to pt-news PT. It it not most elegant solution in the world but since WP is not flexible and its build in rewrite rules have no effect to its behavior (I even tried them from a codex) that was only thing which worked. Perhaps you have more flexible ideas, do you?
Hey nick222,
Make sure that any rewrite rules you add to .htaccess are added before the WordPress .htaccess entry.
We’ll look closely at the pagination in testing and, if necessary will make adjustments.
Thanks Eric, I already figured that out. Now I try to make a plugin which could solve that ancient issue without additional options in .htaccess, which I find old and not flexible way. By the way, did you try to make WordPress core’s rewrite rules? There is build in php rewriter but I could not make it work when I used in functions.php, although I attached my rules to the ‘init’ function.
Thanks Eric, I already figured that out.
Great!
did you try to make WordPress core’s rewrite rules? There is build in php rewriter but I could not make it work when I used in functions.php, although I attached my rules to the ‘init’ function.
Not positive what you’re asking here – we did nothing special with rewrites in this plugin – it relies on WP core rewrite rules.
In /wp-content/plugins/posts-in-page/lib/page_posts.php
I changed line 49:
$page_url = home_url( '/' . $wp_query->post->post_name . '/' );
To:
$page_url = home_url( '/index.php/' . $wp_query->post->post_name . '/' );
This did the trick for me
-
This reply was modified 9 years, 5 months ago by
klwinfoshare.