Support » Plugin: Redirect URL to Post » regression: ignore_sticky_posts is ignored

Viewing 11 replies - 16 through 26 (of 26 total)
  • seems that wptouch handles its homepage redirection separately from its header-link, correctly outputting the url in the latter case & url-encoding the former:-\

    i’ll take it up with wptouch, as r2u is functioning as expected.

    Plugin Author Chris

    (@camthor)

    😀 wptouch seems to be afraid to touch sticky posts. I hope they will be able to help.

    no, unfortunately, wptouch isn’t very responsive to their forum:-\

    as i said, i believe the issue is their handling of their landing page redirection, html-encoding it, causing r2u to miss parameters, which means i can’t debug it:-\

    also can u explain this usage?

    if ( isset( $_GET['rutpdebug'] ) ) {
          $this->debug_messages = array();
          $this->debug_mode = (int) $_GET['rutpdebug'];
          if ( 0 == $this->debug_mode ) {
            $this->debug_mode = 1;
          }
    ...
    }

    debug_mode always =1? and then in

    private function redirect() {
        if ( $this->debug_mode ) {
    ...
          $this->output_debug_messages();
    

    i’m missing something…

    • This reply was modified 2 months, 3 weeks ago by airdrummer.
    Plugin Author Chris

    (@camthor)

    The debugging is set in line 102.

    Or did you mean the sticky posts? In line 468 you find retrieve_get_parameters() . There you could manually add $_GET['ignore_sticky_posts'] = 0; right at the beginning.

    i’m just confused by the use of
    1264 if ( ! $this->debug_mode )
    when it’s set to 1 if 0:

    108      if ( 0 == $this->debug_mode ) {
    110        $this->debug_mode = 1;

    gotta go deliver meals-on-wheels now;-)

    Plugin Author Chris

    (@camthor)

    0: off (parameter not used)
    1: on (parameter comes without value, or with 1)
    2: on with more details

    This is for backwards compatibility. The option with 2 was added later.

    ah, ok, presence===1

    unfortunately, i just hardcoded
    379 'ignore_sticky_posts' => false,
    and both wptouch & desktop still display latest post instead of sticky post for
    https://bostoncamerata.org/?redirect_to=latest but works as expected for
    https://bostoncamerata.org/?redirect_to=latest&ignore_sticky_posts=0
    i can’t seem to catch a break:-\
    here’s output for
    https://bostoncamerata.org/?redirect_to=latest&ignore_sticky_posts=0&rutpdebug=2

    We use redirect_to=latest.
    Query parameters:array(8) {
      ["fields"]=>
      string(3) "all"
      ["ignore_sticky_posts"]=>
      bool(false)
      ["order"]=>
      string(4) "DESC"
      ["orderby"]=>
      string(4) "date"
      ["post_status"]=>
      string(7) "publish"
      ["post_type"]=>
      string(4) "post"
      ["posts_per_page"]=>
      int(100)
      ["suppress_filters"]=>
      bool(true)
    }
    We found 101 matching post(s) in the database.
    We filled the cache with a lifetime of 60 seconds.
    => The resulting URL is: https://bostoncamerata.org/dido-2020/

    which is as expected.

    here’s https://bostoncamerata.org/?redirect_to=latest&ignore_sticky_posts=1&rutpdebug=2

    We use redirect_to=latest.
    Query parameters:
    array(8) {
      ["fields"]=>
      string(3) "ids"
      ["ignore_sticky_posts"]=>
      bool(true)
      ["order"]=>
      string(4) "DESC"
      ["orderby"]=>
      string(4) "date"
      ["post_status"]=>
      string(7) "publish"
      ["post_type"]=>
      string(4) "post"
      ["posts_per_page"]=>
      int(-1)
      ["suppress_filters"]=>
      bool(true)
    }
    We found 741 matching post(s) in the database.
    We filled the cache with a lifetime of 60 seconds.
    => The resulting URL is: https://bostoncamerata.org/filming-begins-for-dido-and-aeneas/

    also as expected.

    but using the default ignore_sticky_posts hard-coded to false
    https://bostoncamerata.org/?redirect_to=latest&rutpdebug=2

    We use redirect_to=latest.
    Query parameters:
    array(8) {
      ["fields"]=>
      string(3) "ids"
      ["ignore_sticky_posts"]=>
      bool(false) // i've hardcoded to false
      ["order"]=>
      string(4) "DESC"
      ["orderby"]=>
      string(4) "date"
      ["post_status"]=>
      string(7) "publish"
      ["post_type"]=>
      string(4) "post"
      ["posts_per_page"]=>
      int(-1)
      ["suppress_filters"]=>
      bool(true)
    }
    We found 741 matching post(s) in the database.
    We filled the cache with a lifetime of 60 seconds.
    => The resulting URL is: https://bostoncamerata.org/filming-begins-for-dido-and-aeneas/

    which is NOT ignoring stickies:-\

    just tried cache=0, still not taking the default of ignore_sticky_posts=>false:
    https://bostoncamerata.org/?redirect_to=latest&rutpdebug=2&cache=0
    returns:

    We use redirect_to=latest.
    Query parameters:
    array(8) {
      ["fields"]=>
      string(3) "ids"
      ["ignore_sticky_posts"]=>
      bool(false)     // note default
      ["order"]=>
      string(4) "DESC"
      ["orderby"]=>
      string(4) "date"
      ["post_status"]=>
      string(7) "publish"
      ["post_type"]=>
      string(4) "post"
      ["posts_per_page"]=>
      int(-1)
      ["suppress_filters"]=>
      bool(true)
    }
    We found 741 matching post(s) in the database.
    => The resulting URL is: https://bostoncamerata.org/filming-begins-for-dido-and-aeneas/

    which is not sticky:-\

    • This reply was modified 2 months, 3 weeks ago by airdrummer. Reason: oops
    • This reply was modified 2 months, 3 weeks ago by airdrummer. Reason: cache=0
    Plugin Author Chris

    (@camthor)

    cache=0 is also hardcoded? You could also define the constant CHATTY_MANGO_RUTP_CACHE in your wp-config.php and set it to zero.

    Anyway, the cache should consider the sticky post parameter. You just need to hardcode it before we create the key for the cache.

    I don’t know where you hardcoded that sticky post parameter. Please note that (as we discovered earlier) the query needs 'fields' => 'all' for sticky posts to work. I see that you often use "ignore_sticky_posts" => false together with "fields" => "ids". So if you want sticky posts, you must also set $this->request_post_objects = true;. (l. 490-494) (We cannot request always objects because another user reported a memory problem and for random posts we have to use all posts, so here we need IDs.)

    ok, thanx

    • This reply was modified 2 months, 3 weeks ago by airdrummer.
    • This reply was modified 2 months, 2 weeks ago by airdrummer.
    • This reply was modified 2 months, 2 weeks ago by airdrummer.
    • This reply was modified 2 months, 2 weeks ago by airdrummer.
    • This reply was modified 2 months, 2 weeks ago by airdrummer.

    i’ve worked around this problem by setting wpt’s landing page to an existing page, then on the existing page setting a quick-redirect to /?redirect_to=latest&ignore_sticky_posts=0

Viewing 11 replies - 16 through 26 (of 26 total)
  • You must be logged in to reply to this topic.