[Plugin: Sidebar Login] Redirect to wrong page after multiple loops (2 posts)

  1. Lopo
    Posted 6 years ago #

    I have a blog with two sidebars. In each sidebar there are "mini-Loops" which retrieve the title of the last post of some categories, using something like this:

    $my_query = new WP_Query(SOME_PARAMETERS);
    if ($my_query->have_posts()):

    As the last widget of the last sidebar, I put Sidebar Login, but if I am viewing a single post, logging in (or logging out) redirects to the last post retrieved by the last "mini-Loop", while it should bring me again to the same post I was viewing.

    It seems that, even using a new WP_Query, $post gets updated, so when sidebar-login.php's line 375 is executed:
    $pageURL = get_permalink(post->ID);
    it gets the permalink of the last post retrieved by the last "mini-Loop".

    My quick fix, and my suggestion for next release, is to modify line 375 as:
    $pageURL = get_permalink($wp_query->post->ID);

    Hope this helps...

    Thank you for your beautiful plugin!


  2. Mike
    Posted 6 years ago #

    Cheers, Will add that.

Topic Closed

This topic has been closed to new replies.

About this Topic