SQL to set Display Name to First Name + Last Name

Figured out the SQL query that can be used to reset the display_name to first_name + last_name. And it’s simpler than the JOINs that I was trying when I posted the question. UPDATE wp_users SET display_name = Concat( (SELECT meta_value FROM wp_usermeta WHERE meta_key = ‘first_name’ AND user_id = id ), ‘ ‘, (SELECT meta_value … Read more

Display data from phpMyAdmin with WordPress

if you are trying to query from the same database in which your WordPress is installed then there is a great way to do sql query with ease. WordPress has a database access abstraction class called wpdb that allows you to run raw mysql query without any issue. You can start using it like one … Read more

Run a sql (update) after 12 hours after the user login. Woocommerce users

You could do something like this (this code has not been testedt). function schedule_sql_command($user_login, $user) { // 12 hours in seconds. $from_now = 12 * 60 * 60; // schedule a call to a custom hook passing in the user’s ID wp_schedule_single_event(time() + $from_now, ‘run_sql_command’, array( $user->ID) ); } // this is the custom hook … Read more

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