Search code examples
mysqldatabasewordpresswordpress-rest-api

wp_insert_post() database changes


I need to repeat all sql requests that occurs during wp_insert_post() execution. Also I need to create categories (also create new if not exists) and custom fields. Is it possible?


Solution

  • When you go to the Wordpress documentation for the wp_insert_post() you will find there section called "source" - you can see there all that is done when function wp_insert_post() is executed.

    You see it's a lot of things. For most cases it is much better to use the built in Wordpress functions.