• Hey guys,

    I need to write a scheduled functionality, checking each post’s content and assigning a specific post category to it in case certain keywords were found, say once every 2 hours. This has to affect all posts.

    The whole thing appears to be problematic from the optimization point of view.

    I’m not sure how could I prevent the site from exceeding the maximal execution time, during the run of such a script. To be honest I’m not even sure if it’s a good idea to do it directly from within WordPress, via WP Cron events. Although I’d appreciate having a WP plugin doing so. The problem comes from the fact that posts were imported from external resources which made it impossible to assign categories automatically.

    Could anyone experienced provide me with any clue?
    Loading all posts at once will surely make extensive usage of memory.
    Running multiple SQL queries would end up in script executing for too long.

    Regards lads,
    Rafal

  • The topic ‘Assign category to all posts based on keywords found.’ is closed to new replies.