Support » Fixing WordPress » Search Post and Change Their Category MySQL Query

  • Hi, iv found this great little php script posted Andrew Kantor at that allows you to search your wordpress posts for certain keywords and then inturn places those posts in a category you specify.

    E.g. Search for posts that have the phrase “Article Marketing” in the title and place them in the “Article Marketing” category.

    This is perfect for me to use on my article directory that contains 170,000 article posts, posted by people that don’t know how to select a targeted category.

    The only little problem with this script is that it doesn’t replace the existing category, it just adds the category you choose to the post and the existing category also remains. Thus having the posts appear in 2 categories each.

    I know very little about php and mysql queries, iv tried to work it out myself but have wasted about 3 hours doing so.

    Can someone please take a look at this code and make adjustments so it removes the existing category and replaces it with the category that you desire.

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Big thanks to anyone that helps


Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Search Post and Change Their Category MySQL Query’ is closed to new replies.