WordPress wp_insert_post post-new.php / post.php not working after updating

The wordpress function “get_default_post_to_edit” inside the “post.php” file located at “wp-admin/includes/” is not working correctly.

When I am loading the page: wp-admin/post-new.php?post_type=product :I get an HTTP 500 error, but it does store a record inside my database, but $post_id echo’s ‘0’ (which is not 0 in the new record).

When I comment out the line below, in this function I mention above, I get no HTTP 500 error, but my page is not working correctly:

$post_id = wp_insert_post( array( 'post_title' => __( 'Auto Draft' ), 'post_type' => $post_type, 'post_status' => 'auto-draft' ) );

When I add the following code after the $post_id = wp_insert_post(…. it echo’s ‘NULL’:

exit(var_dump( $wpdb->last_query));

When I try to save the product page, it tells me I don’t have the permission to do that..

Also when I try to edit an earlier posted product I can retrieve all information, but when I try to save the changes it throws me an HTTP 500 error again in the script “post.php”

All of this happend after I’ve updated WooCommerce and some other
plugins and updated the data structure, I have compared my new scripts
to my old scripts but I dont see any difference.

Could someone please explain to me how I can debug or troubleshoot wordpress in those kind of situations?
~ Any help would be appreciated

Read more here: WordPress wp_insert_post post-new.php / post.php not working after updating

Leave a Reply

Your email address will not be published. Required fields are marked *