Changing regular db connection to $wpdb

Use the global $wpdb object to query your tables. The get_results() method will return your results as you need: global $wpdb; $query = ‘SELECT * FROM students’; $query_results = $wpdb->get_results($query); foreach ($query_results as $student) { // … }

Why can’t I enter the wordpress admin interface?

The error message you see points to this part within the wp-login.php file: setcookie( TEST_COOKIE, ‘WP Cookie check’, 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure ); to its “path”, which is the 4th parameter: SITECOOKIEPATH If you check how that constant is defined, that is: define( ‘SITECOOKIEPATH’, preg_replace( ‘|https?://[^/]+|i’, ”, get_option( ‘siteurl’ ) . “https://wordpress.stackexchange.com/” ) ); meaning … Read more

How do I empty a specific meta_value for all users in PHP

You could specify the meta key in the user query so the results you’re getting back are only for users who have an existing field. For reference WP_User_Query custom field(user meta) params. $args = array( ‘role’ => ‘Subscriber’, ‘meta_query’ => array( array( ‘key’ => ‘old_meta_key_name’, ‘compare’ => ‘EXISTS’ ) ), ); $users_with_meta = new WP_User_Query( … Read more