So I have a form that has makes the action jump to another php page.
There my php code tries to upload a post. I get the following error:
Fatal error: Call to undefined function wp_insert_post()
PHP Code:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == "upload_ugc") {
if($_POST["editindication"] == 'newpost'){
$post_array = array(
'post_title' => $_POST["post_title"],
'post_content' => '',
);
$post_id = wp_insert_post( $post_array, true );
}