I need to do check the inserted post for certain keywords and perform some functions depending on the keywords found.
is there a wordpress hook that executes “just before the post is inserted into the database” ? Or will i have to modify wordpress core ?
Also, i will need to prevent the post from being inserted into the database if some keywords are found. is this something that can be done with a hook ? Or will a core modification be needed ?
Available actions:
- pre_post_update – Runs just before a post or page is updated.
- publish_post – Runs when a post is published, or if it is edited and its status is “published”.
- save_post – Runs whenever a post or page is created or updated, which could be from an import, post/page edit form, xmlrpc, or post by email.
- wp_insert_post – Same as save_post, runs immediately afterwards.
More info: Plugin API/Action Reference
Usage:
<?php
add_action('action_name', 'callback_name');