Support » Plugin: Admin Post Navigation » Fix for Buttons Not Appearing for Some Posts

  • The problem with the previous and next buttons not appearing sometimes has to do with how the code assembles the SQL query.

    The problem is on line 283 of admin-post-navigation.php:

    $sql .= "AND {$orderby} {$type} '{$post->$orderby}' ";

    In some cases $orderby is set to post_title, which produces a SQL query that makes no sense, like this:

    AND post_title > 'Has Your Hand Lettering Spark Fizzled Out? Here's 5 Ways to Stay Motivated & Driven'

    How can a post_title be greater or less than another post_title? This also makes the SQL invalid when the title contains an apostrophe, as the title is not escaped or sanitized in any way.

    My fix was to change line 283 to this:

    $sql .= "AND post_date {$type} '{$post->post_date}' ";

    That fixes the problem, but it stops the c2c_admin_post_navigation_orderby filter from working, so it’s not a perfect fix.

    I don’t know if the developer has abandoned this plugin or not, but I’d be happy to answer any questions and help with an updated version, just let me know!

  • The topic ‘Fix for Buttons Not Appearing for Some Posts’ is closed to new replies.