How to set variable to specific field when querying

Always sanitize input fields. Use $wpdb->get_var to check a single variable. You forgot to add the compare value to the WHERE clause. function username_auth() { global $wpdb; $username = sanitize_text_field( $_POST[‘custom_field_username’] ); $user_login_sql = $wpdb->get_var(“SELECT username FROM registration_info WHERE username=”$username” “); if( $username !== $user_login_sql ) { wc_add_notice((‘Incorrect username123’), ‘error’); } }

What is the meta_query key name for the woo product average rating? [closed]

There are two ways of passing meta arguments to the WP_Query/get_posts, you can check them both in the documentation for WP_Query. There is a single meta structure, like this $args = array( ‘meta_key’ => ‘color’, ‘meta_value’ => ‘blue’, ‘meta_compare’ => ‘!=’ ); And a multi meta structure, like this $args = array( ‘meta_query’ => array( … Read more