Gis Tricks

finding posts in WordPress with a certain word in it

finding posts in WordPress with a certain word in it

a while ago one of my websites was hacked. suddenly a lot of pages had hidden viagra links in them. Quite annoying! Apart from running all sorts of tools I used a simple database query to check for spam. It can be used for basically anything. On a small site you can find everything easily. But on big sites it can be a drag.
Here’s the code (mysql):

select distinct (post_title), post_modified from wp_posts where post_content like '%search_string%' ORDER BY post_modified DESC;

Log in on your phpmyadmin (or similar) and simply replace the search_string with the text you’re looking for.

2 thoughts on “finding posts in WordPress with a certain word in it

  1. Hosting

    Is the plugin searching far back enough for related posts? or does it stop looking for related posts at a certain date? I’m using the widget by the way, with a custom code. Is there any way to have it search through the entire database of posts for related posts?

    1. admin Post author

      It’s not a plugin, simply a query on the database. It will return anything in the database unless you have a limit set per page. Some admin interfaces have that. Then you’ll see it per 30 or something.

Leave a Reply

Your email address will not be published. Required fields are marked *

16 + one =