Extracting the post_id via the wp_insert_post action (external db query)

You shouldn’t be calling get_the_ID() outside of a post loop, and the post ID is handed to you using the filter as a function argument: function insert_new_table( $post_id ){ So use $post_id Added notes Don’t use mysql_connect etc that extension was deprecated and is no longer included by default in newer versions of PHP. This … Read more