I’m using $wpdb->insert to insert data to my plugin table.
How can I get the id of the new line I Just insert.
Because I have a lot of users that add data to the table I can’t use
$wpdb->insert_id
Because it’s not necessary the last one.

2 s
2

There is no other way, but I can not see how you need any other way then this. I believe that the insert ID accessed by $wpdb is the last ID by this instance of WPDB, other inserts should not affect that but I’m not sure.

<?php

  $wpdb->insert("QUERY");

  $this_insert = $wpdb->insert_id;

?>

Leave a Reply

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