Hi,
thanks for your post, and sorry for the trouble.
It looks like you are having similar problems again as about 3 years ago, see https://wordpress.org/support/topic/plugin-conflicts-with-wp-search-and-causes-502-timeout-errors/ ?
It would suggest that you try my suggestion of turning off the TablePress search integration here, then, via that plugin filter hook.
Regards,
Tobias
Actually, it’s not the same. At that time, it was an issue that affected the front-end search. I actually did not use the fix you suggested but instead changed to front-end search to a link to google site search (not ideal, I admit, but simpler for someone who’s not too comfortable with code).
I’ll try what you suggest this time, unless WPEngine has some other suggestions.
Many thanks for your very rapid feedback!
Hi,
well, the frontend search and the search on the Posts screen in the admin area are very closely intertwined, and TablePress integrates into both of them.
So, very likely the suggested fix to turn off that integration will help you here as well.
Regards,
Tobias
Ouch, I tried to post a comment but it seems it got lost. I’ll try again:
I have added that line and it seems to work.
However, it appears it only works if it is in the main theme, not in a child theme. Is that what you’d expect?
It would be unfortunate since it means it will disappear when the theme is updated. (The site is an Elementor site and the theme is the bare-bone Hello Elementor, no customisations.)
I created the child theme with “Child Theme Configurator” and edited the files with “WP File Manager” (two new plugins). (I am not particularly familiar with WP code or php, so I’m just following instructions.) But when I put the line of code in this child theme it had no effect.
On a more general level, I find it a bit curious that we have this issue but apparently not many others. I wouldn’t have thought that our site was particularly exceptional. Yes, we have quite a few tables ~1,000 (adding a handful every month) but is that really so extraordinary? But we have 10,000+ regular posts and WordPress Search handles that without a problem. Is this a behaviour that you’d expect?
Hi,
I’m not completely sure about how the “functions.php” of a child theme is handled, but normally it should also be evaluated. But yes, it’s a risk of the added code getting removed by a theme update.
I have therefore packaged this line in a small custom plugin. So, just download, install, and activate https://tablepress.org/downloads/extensions/tablepress-turn-off-wp-search-integration.zip and you won’t need the change in the “functions.php” anymore.
Now, with 1,000+ tables and 10,000+ posts, I would actually say that your site is definitely high above average 🙂 And I can see why you are running into this problem a bit: Essentially, the search process is a two-step process: First, TablePress searches all tables for the search term. Then, the Shortcodes for all matching tables are added to the search terms, which are then searched in all posts/pages. This uses a regular expression, which (depending on the number of found search results) can be computationally expensive. This likely is what happens here, so that this timeout is raised. It would probably possible to get around this by increasing certain resource limits in the server configuration, but that’s beyond my level of expertise, so that I couldn’t really help with that, and therefore can only recommend to turn off that integration.
Regards,
Tobias
Hi Tobias,
Yes, that sounds like exactly what happens. The tables are between around 10 and 100 lines long. I did some experiments, searching for words that I know are NOT in any table. When I do that, the search works fine. But if I search for something that IS in some of the tables (or even many), say “bordeaux”, then I get a 502 timeout. So it seems likely that it is the double search and the computation to do the matching that causes the problem.
I guess the only way around that is to use some external search tool that scans the front-end pages instead.
Wow – that plugin to disable the search integration was fantastic. Simple and works perfectly. I’ve tested on on our Dev site without any problem so I’ll enable it on our live site soon. Thank you!!
Hi,
thanks for testing this! Yes, that essentially confirms my assumption.
Good to hear that turning off the TablePress integration into the WP search via that plugin works!
Ultimately, the question is how important searchable tables are for you. If you want them searchable, an external search solution (scanning the front-end pages) would indeed be a proper approach here.
Best wishes,
Tobias