I’m using WP ALL Import to import thousands of posts from a custom XML file. I filter it the best I can with XPath, but some conditions have to be done in PHP.
How can I hook into the process of saving the post and check certain conditions using PHP, and in case the conditions fail, prevent that single post from being saved into the DB?
I don’t want to stop the whole import process though.
I found some filters (content_save_pre, pre_post_update, wp_insert_post, etc) but not sure how to implement them and more importantly how to avoid the post from being saved.
I know I can easily execute my code and delete the posts I don’t need once the import process is finished, or after each post is created, but I would like to avoid inserting a post into DB just to possibly have to delete it seconds later.