• Resolved visingo

    (@visingo)


    I installed the Category Thumbnails Plugin.
    I went under categories in the admin panel.
    Edit an already existing category. Clicked on “add Category image”.
    After trying to upload an image, I got this database error:
    Can someone help, please? 🙂

    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 's Guide to Heart Surgery",
    "filesizeInBytes":95335,"filesizeHumanReadable":"93 kB' at line 1]
    
    UPDATE <code>wp_term_taxonomy</code> SET <code>term_thumbnail</code>='{"id":37,"title":"landscape","filename":"landscape.jpg","url":"http://project.dev/app/uploads/2015/11/landscape.jpg","link":"http://project.dev/a-site/landscape/","alt":"","author":"1","description":"","caption":"","name":"landscape","status":"inherit","uploadedTo":26,"date":"2015-11-04T09:12:08.000Z","modified":"2015-11-04T09:12:08.000Z","menuOrder":0,"mime":"image/jpeg","type":"image","subtype":"jpeg","icon":"http://project.dev/wp/wp-includes/images/media/default.png","dateFormatted":"November 4, 2015","nonces":{"update":"148182415e","delete":"2bb9a7e647","edit":"627300347c"},"editLink":"http://project.dev/wp/wp-admin/post.php?post=37&action=edit","meta":false,"authorName":"WordPress User","uploadedToLink":"http://project.dev/wp/wp-admin/post.php?post=26&action=edit","uploadedToTitle":"A Patient's Guide to Heart Surgery","filesizeInBytes":95335,"filesizeHumanReadable":"93 kB","sizes":{"thumbnail":{"height":150,"width":150,"url":"http://project.dev/app/uploads/2015/11/landscape-150x150.jpg","orientation":"landscape"},"medium":{"height":168,"width":300,"url":"http://project.dev/app/uploads/2015/11/landscape-300x168.jpg","orientation":"landscape"},"full":{"url":"http://project.dev/app/uploads/2015/11/landscape.jpg","height":378,"width":674,"orientation":"landscape"}},"height":378,"width":674,"orientation":"landscape","compat":{"item":"","meta":""}}' WHERE <code>term_id</code>='1' LIMIT 1

    Warning: Cannot modify header information - headers already sent by ...

    https://wordpress.org/plugins/category-thumbnails/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Presumably because the author didn’t escape strings before passing them to SQL.

    Try replacing the $wpdb->query(sprintf('UPDATE... line near the bottom of category-thumbnails.php with this:

    if ($data !== NULL) {
    	$data = base64_decode($data);
    }
    $wpdb->update(
    	$wpdb->prefix . 'term_taxonomy',
    	array('term_thumbnail' => $data),
    	array('term_id' => $category)
    );
    Plugin Author Patrick

    (@hovida)

    Fixed.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Not useable since WordPress 4.3.1 – Database error’ is closed to new replies.