Yoast 5.2 breaks wp-admin content searching
- [x] I've read and understood the contribution guidelines.
- [x] I've searched for any related issues and avoided creating a duplicate issue.
I did a search for "wp-admin search" and did not see any results on the first few pages
Please give us a description of what happened.
After upgrading to Yoast SEO 5.2, using the search functionality on the admin dashboard no longer works.
Please describe what you expected to happen and why.
I have several Posts that contain the word "workplace". If I log into my site and go to the "Posts" section of the wp-admin dashboard, when I try to search for all posts that contain the phrase "workplace", it returns 0 results. This used to work before updating.
If I disable Yoast SEO and perform the same search, I see the results. If I re-enable, no results are found when I search on the wp-admin page.
Note: For this example, I am using the generic "Posts" object type. This happens when I search on any custom post type on the admin dashboard.
How can we reproduce this behavior?
- Go to the admin dashboard for Posts (/wp-admin/edit.php)
- In the search box, type a search term that should return results
- After you search, no results will be returned.
Technical info
- WordPress version: 4.8.1
- Yoast SEO version: 5.2
- Relevant plugins in case of a bug: I am using WPML, but even if I disable WPML, I can still reproduce this bug.
If I look at the error logs, I see this 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 '-1' at line 3 for query SELECT SQL_CALC_FOUND_ROWS vz5sh_posts.ID FROM vz5sh_posts JOIN vz5sh_icl_translations t\r\n\t\t\t\t\t\t\tON vz5sh_posts.ID = t.element_id\r\n\t\t\t\t\t\t\t\tAND t.element_type = CONCAT('post_', vz5sh_posts.post_type) WHERE 1=1 AND (((vz5sh_posts.post_title LIKE '%workplace%') OR (vz5sh_posts.post_excerpt LIKE '%workplace%') OR (vz5sh_posts.post_content LIKE '%workplace%'))) AND vz5sh_posts.post_type = 'post' AND (vz5sh_posts.post_status = 'publish' OR vz5sh_posts.post_status = 'acf-disabled' OR vz5sh_posts.post_status = 'future' OR vz5sh_posts.post_status = 'draft' OR vz5sh_posts.post_status = 'pending' OR vz5sh_posts.post_status = 'private') AND ( ( t.language_code = 'en' AND vz5sh_posts.post_type IN ('post','page','acf-field-group','news-item','event','person','work','recognition' ) ) OR vz5sh_posts.post_type NOT IN ('post','page','acf-field-group','news-item','event','person','work','recognition' ) ) ORDER BY vz5sh_posts.menu_order ASC LIMIT 0, -1 made by 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, WPSEO_Link_Columns->count_objects, WPSEO_Link_Columns->set_count_objects, WP_Query->get_posts
I found that if I go into plugins > wordpress-seo > admin > links > class-link-columns.php, if I go to the register_hooks() function and comment out the following two lines, searching in the wp-admin section works again, but I am not sure what this would break:
add_action( 'manage_posts_extra_tablenav', array( $this, 'count_objects' ) );
add_filter( 'admin_init', array( $this, 'register_init_hooks' ) );
Note: I just updated to 5.3.2, and this issue is still happening. I am seeing the same error in my log file.
Thank you for your bug report. Unfortunately, this is not a bug, but a support request. I tried to reproduce your issue, but I'm unable to. Seeing the error log, it's an issue with your database specific to your site. Your host might be able to assist you.
To receive free support for Yoast SEO we have the following channels:
- Yoast Knowledge base
- Support forums on WordPress.org
Or if you want personal support via email, you can purchase Yoast SEO Premium.
Thanks for your understanding.