$wpdb->insert_id

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; ?>

What is the correct way to build a widget using OOP

You can simply put your init code within the constructor of the class. For example: class myWidget extends WP_Widget{ function myWidget(){ // Init code here } function widget( $args, $instance ) { // The widget code wp_enqueue_script(…); wp_enqueue_style(…); } // Over methods… } register_widget(‘myWidget’); My preference is to actually put the enqueue calls within the … Read more

Using register_activation_hook in classes

Having reread your question, I think I see the issue, and it stems from a misunderstanding of how register_activation_hook works, combined with some confusion over how you’re bootstrapping your code and what it means to bootstrap Part 1: register_activation_hook This function takes 2 parameters: register_activation_hook( string $file, callable $function ) The first parameter, $file is … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)