Straight after the $wpdb->insert()
that does the insert, do this:
$lastid = $wpdb->insert_id;
More information about how to do things the WordPress way can be found in the WordPress codex. The details above were found here on the wpdb class page
More Related Contents:
- How would I modify this WordPress theme?
- I have developed a WordPress website using localhost.How can I give that to my client?
- Can’t take screenshot after changing WordPress theme on win 10
- Listing , pagination and search custom user data by role in wordpress
- Using WPDB in standalone script?
- PHP Warning: POST Content-Length of 8978294 bytes exceeds the limit of 8388608 bytes in Unknown on line 0
- Can I install/update WordPress plugins without providing FTP access?
- WordPress putting %E2%80%8E at the end of my url, howcome?
- WordPress filter to modify final html output
- Retrieve WordPress root directory path?
- How to include pagination in a WordPress Custom Post Type Query
- Trying to get contact form 7 post data to debug to screen
- WordPress REST API (wp-api) 404 Error: Cannot access the WordPress REST API
- How do I debug a WordPress plugin?
- How can I get the current page name in WordPress?
- Get cart item name, quantity all details woocommerce
- wp_nav_menu change sub-menu class name?
- Woocommerce checkout page internal server error
- WordPress asking for my FTP credentials to install plugins
- Why is WordPress placing “text/rocketscript” instead of “text/javascript” when using wp_register_script()?
- WooCommerce show custom column
- How to pass data between wordpress pages
- wordpress – make custom field values clickable to retrive them later
- Woocommerce get variation product price
- Configuring WordPress .htaccess to view subfolders
- How to fetch a wordpress admin page using google apps script?
- Exclude a folder/directory from RewriteRule
- Remove category and tag base from WordPress URLs without a plugin?
- How can I get the order ID in WooCommerce?
- WordPress session management