WordPress.org

Ready to get started?Download WordPress

Forums

Search Post and Change Their Category MySQL Query (2 posts)

  1. Melbourne Cup Sweep
    Member
    Posted 4 years ago #

    Hi, iv found this great little php script posted Andrew Kantor at http://wordpress.org/support/topic/300069?replies=8 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

    Hayzie

  2. Melbourne Cup Sweep
    Member
    Posted 4 years ago #

    Code has been moded out for some annoying reason, here it is, please help. http://wordpress.pastebin.com/imSpdb1q

Topic Closed

This topic has been closed to new replies.

About this Topic