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');
}
}
Related Posts:
- How to select WooCommerce products by post_meta and order them
- Setting All Drafts to ‘exclude-from-catalog’ in WooCommerce
- Get WooCommerce product details and transfer them to a custom DB table
- Sum the total amount of a specific product purchased per user and display in table
- email alert for product availability
- WordPress WP_Query without query GET parameters
- Modify WooCommerce used to get all orders in dashboard
- Convert a column of a table containing an Array as response in HTML
- How to import woocommerce custom fields data into another site?
- append data to mysql table via submit button coded in php – not working
- How to detect if a revision was made by woocommerce or wordpress?
- Can i use php sql functions instead of $wpdb?
- How to validate WordPress generated password in DB using PHP?
- Custom query to get post names beginning with a digit
- How To Make Connection To WordPress Data Base In A Plugin?
- How to track a users progress through pages by inserting data into WordPress Database?
- the_author_meta not working
- Replace existing content from specific WooCommerce admin orders list column
- Woocommerce – How to get products which have a sale between 20% to 40%? [closed]
- Woocommerce filter cart and category specific quantity [closed]
- How to migrate the posts from an old custom legacy blog to a new WordPress website?
- mysqli_real_connect() – authentication method unknown to the client Warnings
- How to get woocommerce cart content without an action?
- Do I need to prepare query before get_results(), get_row() and get_var()?
- WooCommerce: Add Payment Gateway Field to Webhooks [closed]
- How to create and work with custom data / tables (i.e., for arbitrary data)?
- Woocommerce product download URL
- Limiting woocommerce line_total decimal length
- How can I use wp_query to show all product data using just the products ID?
- Get stock by custom meta field on all Woocommerce variable products
- Set a condition based on WooCommerce checkout city field while placing order
- Call global variable array() in woocommerce child/template
- Remove price from Woocommerce variable product dropdown menu
- I want to select the from values from database in WordPress? [closed]
- User management system similar to wordpress one?
- SQL Injection blocked by firewall
- Get and insert order email address to the PHP template inside HTML text
- If no products are on sale – hide ID or class
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- do search in two site and show the result in first site
- How can I pass a custom/dynamic product to the Woocommerce cart?
- Long running queries
- How to get private property in parent class into extended class?
- Replace Woocommerce “add to cart” to be “Download” button [closed]
- Custom array from a query only write the last row of the query
- Woocommerce Email attachments not working – file not being attached
- WordPress Block developer from exporting Database via PHP
- How do I display offsite database info on my wordpress site?
- Use $wpdb or other PHP script method to find/replace in WP database
- Issue with fetching mysql data and displaying results via shortcode in webpage
- WooCommerce pages looks unstyled
- How to display a custom product field value of a specific category on a Woo Commerce checkout page?
- Personalize checkout text
- Custom route and query
- Disable if there are no children – Woocommerce
- Edit Account – read and write to MySQL
- Custom Taxonomy Select Menu: Setting default option value?
- Why when I create a new post I found 2 record related to this post into the posts database table?
- mySQL queries are executed twice on wordpress website
- Most viewed posts in WordPress
- Woocommerce Custom Meta Boxes- How to only display if they actually have content
- Display Sibling WooCommerce Product Categories on Archive Page
- How to sort WooCommerce products page by latest in-stock items first?
- WP_Query for woocommerce products with a pattern as a post_title
- What’s wrong in my PHP code? I’m using WordPress Astra Theme and I can’t insert data into my SQL
- Get mysql data for Quick Edit panel
- Generate images with html2canvas and the woocommerce api
- How to update ticket price programatically when adding to cart and checkout in woocommerce
- Woocommerce My acount page
- Get WooCommerce products with similar SKU
- global $product is empty string when passed into function
- Use CSS tag inside PHP code
- Set ACF on order during checkout
- Hide payment method based on user role AND minimum cart value
- How can I show how much water got saved on this order (making use of the number of items bought) on a thank-you-page?
- IF statement not working – Any suggestions?
- WooCommerce function not working correctly after moving from the functions.php into a class
- Filter for product subcategory listing page load
- Reduce Stock Based on Custom Variation Field Rather than Attribute (Working Script)
- get_filtered_term_product_counts – Get product terms if any products
- Get x numbers of a woocommerce category products using Wp_Query
- Get field value and use as variable in php
- Set notification if is two product category in cart
- AJAX to add to cart multiple products woocommerce
- Change upload URL by mime type
- Reverse Cross-Sells (WooCommerce)
- Unexpected behavior when trying to manually install WordPress on macOS Sierra
- WordPress post insertion from PHP file
- Search function not working
- loop to return tags in woocommerce in alphabetical order?
- Rewrite SQL query as a prepared statement and use in foreach loop
- I was wondering if it’s possible to implement card.js on WordPress
- Woocommerce custom field on emails outputs ‘Array’
- Include a custom field in mysql query
- Insert double entry in DB
- Splitting One Big WordPress Site into Multiple Small Sites
- WooCommerce Custom Pagination
- How to edit the default database of WordPress [closed]
- WooCommerce Checkout Cart [closed]
- Woocommerce – add tracking code to another email template