I produced a code which creates content and I wish to populte Wodrpress`s database by using it I'm using wp_insert_post and add_post_meta functions but each time I load which triggers the script I recieve this error:

Fatal error: Call to undefined function add_action() in \www\scriptmafia\wp-includes\post.php on line 153

In my opinion it because of some missing includes. I've incorporated publish.php so it pointed out as needed include for wp_insert_post function. I understand this really is pretty common among newcomers in WordPress. However, any sullution I've attempted haven't labored for me personally.

require_once( ABSPATH . '/wordpress-load.php') should solve it :)