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:
More info: Plugin API/Action Reference
Usage:
The hook is save_post:
add_action('save_post', 'dosomething'), 10, 2);
the hook is
wp_insert_post_data
which as two parameters ($data, $postarr) and its a filter hook that fires before inserting the post into the database so:
as for
save_post
hook it happens after inserting the post to database.