• I find this in my error_log:

    [04-Oct-2012 10:41:45] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ” at line 1 for query SELECT * FROM wp_post_sorting WHERE category = made by require(‘wp-blog-header.php’), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, apply_filters_ref_array, call_user_func_array, post_sorting

    Can you please fix? I love this plugin has been very helpful to organize my site. Thanks for your help.

    http://wordpress.org/extend/plugins/wp-post-sorting/

Viewing 7 replies - 1 through 7 (of 7 total)
  • This happens for me, but only on pages that don’t exist. Since the plugin hasn’t been updated in a long time, I’m guessing the author has gone away. I’ll see if I can find an easy fix for it.

    Thread Starter clane_workforce

    (@clane_workforce)

    @jondaley Thanks for your reply. I’ve communicated with the owner of the pluginand received the following reply:

    Unfortunately that plugin hasn’t been update in the last 2 years. What we’ll try to do is try and update it in the next 30 days or so, because it’s not a big plugin and I realize there are still people still using it.

    Thank you for reporting it,
    Cristian Antohe
    http://www.reflectionmedia.ro
    http://www.cozmoslabs.com

    I hope you can find the issue. I’ve went through every line of code and thought it might be as simple as improper use of double and single quotes, but that is not the case. Take care:)

    I’m now looking into this, and adding myself (or others) a note here that when I said “pages” that don’t exist above, I actually meant it – not just “posts” that don’t exist…

    The bug is in wpps_hook_posts_orderby.php, though the code seems reasonable to me, at first glance:

    if(!is_category()) return;
    followed by
    get_query_var('cat');

    The get_query_var returns null.

    I’ll take a look at the is_category function, since I don’t know why that is returning true.

    Aha.

    At least in my case, I am using the “custom structure” for permalinks, set to: /%category%/%postname%/

    This causes *any* url that looks like /asldasldkjasdl to make is_category() return true.

    I no longer think this is a bug in wp_post_sorting, but in the wordpress core, unless there is something I am doing wrong in my permalink settings, or there is an update to is_category() to make it actually check if it is a real category.

    I fixed the bug by changing is_category() in wp-includes/query.php.

    I don’t know why it always returns true if the category parameter given is empty. Though I am a little confused about having a member variable and a member function both named is_category – that seems like it is asking for trouble. I’m not sure why my “is_category” variable is set to true – must have gotten set somewhere previously…

    I’ll try to forward this bug report to the WP core to see if someone can shed any light on this.

    No response today on the other bug, though there is a bug in the forums, so I’ll post it again tomorrow.

    http://wordpress.org/support/topic/heh-putting-a-percent-in-the-topic-title-causes-this-forum-to-break

    http://wordpress.org/support/topic/permalink-%categorypostname-makes-is_category-return-true-for-404s

    I have another fix, at least for when this bug appears in the post-sorting plugin, though the true fix is anyone who uses the is_category() function.

    Add this line:
    if(!$cat) return $orderby;

    in wpps_hook_posts_orderby.php after the existing line:
    $cat = get_query_var('cat');

    Thread Starter clane_workforce

    (@clane_workforce)

    @jondaley Thanks for the help. I’ll try this change and see if the SQL errors stop. I too am using a custom permalink structure /%category%/%postname%/ same as you. Awesome:)

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: WP Post Sorting] WordPress database error’ is closed to new replies.