• Resolved supervinnie40

    (@supervinnie40)


    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.

    https://www.ads-software.com/plugins/redirect-url-to-post/

Viewing 15 replies - 1 through 15 (of 25 total)
  • Plugin Author Christoph

    (@camthor)

    Sorry about the troubles!
    I checked on one of my blogs, it is working fine: https://www.weirdthingsinprague.com/?redirect_to=random

    It 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&abc

    and 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.

    Thread Starter supervinnie40

    (@supervinnie40)

    Plugin Author Christoph

    (@camthor)

    If you temporarily unpublish that post – does it go to the post, which is then the latest, or to an error (not found) page?

    Plugin Author Christoph

    (@camthor)

    Is this a “multi-site’ installation?

    Thread Starter supervinnie40

    (@supervinnie40)

    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.

    Plugin Author Christoph

    (@camthor)

    I also tried https://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.

    Thread Starter supervinnie40

    (@supervinnie40)

    You seem to be online right now. So I’ll deactivate all plugins and switch theme for the next hour orso.

    Plugin Author Christoph

    (@camthor)

    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?

    Thread Starter supervinnie40

    (@supervinnie40)

    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 #3

    So 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?

    Thread Starter supervinnie40

    (@supervinnie40)

    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)

    Plugin Author Christoph

    (@camthor)

    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 permalink

    That way I hope not to break any features of the theme.

    Thread Starter supervinnie40

    (@supervinnie40)

    Sorry for the late reply. Gonna try it now.

    Thread Starter supervinnie40

    (@supervinnie40)

    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 ??

    Plugin Author Christoph

    (@camthor)

    That’s weird…

    Is it a free theme? Maybe the theme author can give a hint.

    Plugin Author Christoph

    (@camthor)

    You could also try

    wp_reset_query();

    after “remove_all_filters”. Not sure though…

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘Keeps showing the same post’ is closed to new replies.