• Resolved Eirudo

    (@eirudo)


    Hello, on debug mode there’s an error:

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘ORDER BY score DESC, post_modified DESC LIMIT 1’ at line 4]

    SELECT p.ID, if(INSTR(LCASE(p.post_name), ‘windows’), 1, 0) + 0 as score FROM erd_posts AS p WHERE p.post_status = ‘publish’ AND ORDER BY score DESC, post_modified DESC LIMIT 1

    When I’m trying to test https://myblog.com/windows

    How to fix it?
    Thankyou

    • This topic was modified 6 years, 10 months ago by Eirudo.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello

    Thank you for the report. Please can you tell me your MariaDB version? I’ll try to make it compatible.

    Regards.

    Thread Starter Eirudo

    (@eirudo)

    Hello,

    MariaDB version is:
    MariaDB-server-10.0.33-1.el6.x86_64

    —–

    It is possible to hook or modify, so this plugin load the post/page directly (with modify header status code to 200) instead of redirect?

    Thankyou ??

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Can you try this quick fix?

    In the file /plugins/wp-404-auto-redirect-to-similar-post/wp-404-auto-redirect-similar-post.php Line: 491

    Find ORDER BY score DESC, post_modified DESC LIMIT 1";

    Replace to: ORDER BY score DESC LIMIT 1";

    Let me know if it works for you!

    Regards.

    Thread Starter Eirudo

    (@eirudo)

    Hello, still error

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘ORDER BY score DESC LIMIT 1’ at line 4]
    SELECT p.ID, if(INSTR(LCASE(p.post_name), ‘windows’), 1, 0) + 0 as score FROM wp_posts AS p WHERE p.post_status = ‘publish’ AND ORDER BY score DESC LIMIT 1

    ??

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Okay I’ll setup a MariaDB and see how to fix it!

    Thanks for your help!

    Regards.

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    I found the fix!

    In the plugin file: wp-404-auto-redirect-similar-post.php

    Line 467
    Find: WHERE p.post_status = 'publish' AND ";
    Replace to: WHERE p.post_status = 'publish' ";

    Line 470
    Find: $sql .= "
    Replace to: $sql .= "AND

    Line 480
    Find: $sql .= '(' . implode(' OR ', $post_types) . ')';
    Replace to: $sql .= 'AND (' . implode(' OR ', $post_types) . ')';

    I’ll publish the official update soon. Let me know if it works ??

    Regards.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘You have an error in your SQL syntax’ is closed to new replies.