3

I'm looking at my slow queries and i don't understand how some bot or person is doing them. They look like this: (i copy/paste them no placeholders!)

SELECT post_id FROM wp_postmeta, wp_posts WHERE ID = post_id AND post_type = 'rentals' AND meta_key = '_wp_old_slug' AND meta_value = '%5dsibbo-cmp-layoutthor-cookiesdiv';

SELECT post_id FROM wp_postmeta, wp_posts WHERE ID = post_id AND post_type = 'rentals' AND meta_key = '_wp_old_slug' AND meta_value = 'sauved2ahukewjjx9uu2zb8ahvwbxaihz3waceqfnoecaiqagusgaovvaw2fcppukbhgtva5flmmmnzl';

These are increasing server load in the server. I don't understand how can you even query by meta_value in the front end?! Makes no sense to me.

1 Answer 1

5

They're from WordPress. They come from the wp_old_slug_redirect() function which is run whenever there is a 404. The purpose is to check if the requested URL was the old URL for a post so that it can redirect to the new URL.

If you're seeing a lot of these then it means you're getting a lot of 404 hits. The slugs in your example suggest that it's probably bots, but it's hard to say. I highly doubt this query alone is causing significant server load. It's probably the volume of the requests themselves that is the problem.

2
  • Great maybe not this query alone but it's contributing. I think bots are sending random 404 cos those slugs are ridiculous. I will have to remove the feature entirely. Would this stop these queries? wordpress.stackexchange.com/questions/292488/… thanks! Commented Jan 10, 2023 at 9:03
  • 1
    @MichaelRogers Yes it would. Commented Jan 10, 2023 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.