Keeps showing the same post
-
Hi there,
Thank you for the plugin.
As per your guide, I put /?redirect_to=random on the end of the URL in mijn menu. But I keep going to post #1.
If only have 10 posts right now, with 5 categories, but each time I click the link I keep going to post #1.It kinda seems the plugin isn’t working for me.
I deactivated all the plugins and tried to change theme, with no effect.
-
Sorry about the troubles!
I checked on one of my blogs, it is working fine: http://www.weirdthingsinprague.com/?redirect_to=randomIt sounds to me like a caching problem. You could find out by adding various further queries with &, such as
... ?redirect_to=random&123 ... ?redirect_to=random&abcand see if that makes a difference.
Since you said you disabled all plugins, the caching could take place
- in your browser (I have that issue in Safari – try to restart or use another one), or
- in another step of caching, e.g. if you use Cloudflare (try “No Query String”).
Let me know if that helps.
Just tried your 2 links and then wiped the cache (chrome) and tried the 2 links again.
No results.
The site: http://www.mijncreaties.com/seconddetailingwiki/
http://www.mijncreaties.com/seconddetailingwiki/?redirect_to=random
http://www.mijncreaties.com/seconddetailingwiki/?redirect_to=random&123
http://www.mijncreaties.com/seconddetailingwiki/?redirect_to=random&abcAs you see I keep getting the same post.
If you temporarily unpublish that post – does it go to the post, which is then the latest, or to an error (not found) page?
Is this a “multi-site’ installation?
I go to post #2.
(I left post #1 unpublished so you can check via the links above π ).
Its not multisite. There are 3 different WordPress installs on this domain, but all in different folders with their own database. They are not links in any way with each other.
I also tried http://www.mijncreaties.com/seconddetailingwiki/?redirect_to=custom&orderby=rand – no change.
First thing that comes to my mind is the interference of a filter. But if deactivating all other plugins and themes didn’t make a change, this cannot actually be the reason.
You seem to be online right now. So I’ll deactivate all plugins and switch theme for the next hour orso.
Now (with deactivated plugins and default theme) it seems to work.
Can you confirm it? If yes, could you re-activate one by one and find out, which one is interfering? (Maybe start with the theme.)
Are you familiar with PHP and can test a modification of the plugin?
Correction:
It seems switching themes DOES work.For some reason I often get the same post several times, but after a few times I get another post. This time it was
1st click: post #2
2nd click: post #2
3rd click: post #2
4th click: post #2
5th click: post #4
6th click: post #3So it does seem to work, but it probably doesn’t like websites with a small amount of posts π (working on that π ).
Any clue what the conflict could be? Might be in Functions.php?
I’m familiar with PHP and can upload directly to the site.
Even with all plugins activated, it still works on Twenty Sixteen.Edit: after trying it with a few more themes. It works with all the standard WordPress themes, but not my custom theme. (wikiWP)
So, next thing you could try is to add
remove_all_filters('posts_orderby');to redirect-url-to-post.php, maybe in line 199 before the comment
// Retrieve the first post and redirect to its permalinkThat way I hope not to break any features of the theme.
Sorry for the late reply. Gonna try it now.
Did exactly what you said:
$args_add = array(); break; // Unrecognized value of 'redirect_to' => finish processing and let other plugins do their work default: return; break; } remove_all_filters('posts_orderby'); // Retrieve the first post and redirect to its permalink if ( isset( $args_add ) ) { $args = array_merge( $args_query_values, $args_add ); $posts = get_posts( $args ); if ( !empty( $posts ) ) { $post = array_shift( $posts );But no effect π
That’s weird…
Is it a free theme? Maybe the theme author can give a hint.
You could also try
wp_reset_query();after “remove_all_filters”. Not sure though…
The topic ‘Keeps showing the same post’ is closed to new replies.