Hi,
Try This in File wordpress-seo\admin\links\class-link-column-count.php in function name get_results().
Please change the following query.
Before Changing query:
$results = $wpdb->get_results(
$wpdb->prepare( ‘
SELECT internal_link_count, incoming_link_count, object_id
FROM ‘ . $storage->get_table_name() . ‘
WHERE object_id IN ( %1$s )’,
implode( ‘,’, $post_ids )
),
ARRAY_A
);
After Changing query:
$imploded_post_ids = implode( ‘,’, $post_ids );
$results = $wpdb->get_results(
‘SELECT internal_link_count, incoming_link_count, object_id
FROM ‘ . $storage->get_table_name() . ‘
WHERE object_id IN ( ‘.$imploded_post_ids.’)’,ARRAY_A
);
and check.
This solved my problem.
Thanks
I’m also seeing this error, which started after the update to WP 4.8.2:
[20-Sep-2017 08:45:07 UTC] 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 '%2$s
WHERE target_post_id IN( %3$s )
GROUP BY target_post_id' at line 2 for query
SELECT COUNT( id ) AS incoming, target_post_id AS post_id
FROM %2$s
WHERE target_post_id IN( %3$s )
GROUP BY target_post_id made by edit_post, wp_update_post, wp_insert_post, do_action('save_post'), WP_Hook->do_action, WP_Hook->apply_filters, WPSEO_Link_Watcher->save_post, WPSEO_Link_Content_Processor->process, WPSEO_Link_Content_Processor->update_incoming_links, WPSEO_Meta_Storage->update_incoming_link_count
If @wordpressbeta’s comment is correct (I’ve not tried it) this would fit with the change to $wpdb->prepare() noted in the 4.8.2 release notes.
Hi,
You can also try this in File wordpress-seo\admin\links\class-link-column-count.php in function name get_results().
$no_strings = count($post_ids);
$ids_placeholders = array_fill(0, $no_strings, “%d”);
$format = implode(‘, ‘, $ids_placeholders);
$results = $wpdb->get_results(
$wpdb->prepare
(
‘SELECT internal_link_count, incoming_link_count, object_id
FROM ‘ . $storage->get_table_name() . ‘
WHERE object_id IN (‘.$format.’)’,
$post_ids
),ARRAY_A
);
This too solved your problem.
Thanks
Sure. I’ve no doubt this would patch the issue, but it’s not a long-term fix. (It’s bad practice to modify plugin code).
We need Yoast to correct their plugin. This thread (and the other similar ones) show it’s a broader issue with the 4.8.2 WP core that Yoast need to address.
Hello,
This issue has been corrected in the latest release of the Yoast plugin. Please update to Yoast SEO 5.4.1.
Thanks!
Hi
We had similar errors:
[Thu Sep 21 08:38:59.717727 2017] [:error] [pid 30293] [client 109.204.149.225:54228] WordPress-tietokannan virhe 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 ‘%1$s )’ at line 3 kyselylle \n\t\t\t\tSELECT internal_link_count, incoming_link_count, object_id\n\t\t\t\tFROM ss_yoast_seo_meta\n\t\t\t WHERE object_id IN ( %1$s ) Tekij\xc3\xa4: WP_List_Table->display, WP_List_Table->display_tablenav, WP_Posts_List_Table->extra_tablenav, do_action(‘manage_posts_extra_tablenav’), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, WPSEO_Link_Columns->count_objects, WPSEO_Link_Columns->set_count_objects, WPSEO_Link_Column_Count->set, WPSEO_Link_Column_Count->get_results, referer: https://salpaus-testi.aurorads.pro/wp-admin/
[Thu Sep 21 08:39:05.692699 2017] [:error] [pid 30285] [client 109.204.149.225:54226] WordPress-tietokannan virhe 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 ‘%1$s )’ at line 3 kyselylle \n\t\t\t\tSELECT internal_link_count, incoming_link_count, object_id\n\t\t\t\tFROM ss_yoast_seo_meta\n\t\t\t WHERE object_id IN ( %1$s ) Tekij\xc3\xa4: WP_List_Table->display, WP_List_Table->display_tablenav, WP_Posts_List_Table->extra_tablenav, do_action(‘manage_posts_extra_tablenav’), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, WPSEO_Link_Columns->count_objects, WPSEO_Link_Columns->set_count_objects, WPSEO_Link_Column_Count->set, WPSEO_Link_Column_Count->get_results, referer: https://salpaus-testi.aurorads.pro/wp-admin/edit.php?post_type=page
[Thu Sep 21 08:39:07.543126 2017] [:error] [pid 30293] [client 109.204.149.225:54228] WordPress-tietokannan virhe 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 ‘%1$s )’ at line 3 kyselylle \n\t\t\t\tSELECT internal_link_count, incoming_link_count, object_id\n\t\t\t\tFROM ss_yoast_seo_meta\n\t\t\t WHERE object_id IN ( %1$s ) Tekij\xc3\xa4: WP_List_Table->display, WP_List_Table->display_tablenav, WP_Posts_List_Table->extra_tablenav, do_action(‘manage_posts_extra_tablenav’), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, WPSEO_Link_Columns->count_objects, WPSEO_Link_Columns->set_count_objects, WPSEO_Link_Column_Count->set, WPSEO_Link_Column_Count->get_results, referer: https://salpaus-testi.aurorads.pro/wp-admin/edit.php?post_type=page
With previous version of YOAST, disabling it helped. After installed the latest version sites are still broken even YOAST is disabled!
Our “Yoast SEO” 5.4 was causing this WordPress database error too, visible on the Admin Desktop.
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 ‘%1$s)’ at line 3]
SELECT internal_link_count, incoming_link_count, object_id FROM …_yoast_seo_meta WHERE object_id IN (%1$s)
We have WordPress 4.8.2.
Yoast SEO update onto 5.5. helped, the error seems to be away.