How to auto-generate random numbers in username?

This function would generate a unique user login slug: function my_unique_user_slug( $slug ) { global $wpdb; $check_sql = “SELECT user_login FROM $wpdb->users WHERE user_login = %s LIMIT 1”; if ( ! $wpdb->get_var( $wpdb->prepare( $check_sql, $slug ) ) ) { return $slug; } $suffix = 2; do { $alt_slug = $slug . $suffix; $user_slug_check = $wpdb->get_var( … Read more

Woocommerce textarea format ignored

The answer you’ve based your code off uses esc_attr() incorrectly on this line: update_post_meta( $variation_id, ‘my_text_field’, esc_attr( $text_field )); esc_attr() is for escaping a value so that it can be placed in an HTML attribute on output. This is a completely incorrect use of it, and it’s what is converting your < and > characters. … Read more

WordPress eMails not working

Check if youre WP can send out any emails to begin with : https://wordpress.org/plugins/check-email/ is a good one to try. If you have trouble sending emails with the standard setup you could also try https://wordpress.org/plugins/wp-mail-smtp/#description and use Gmail or a 3rd party SMTP service to send email. This plugin also has fairly advanced debugging options … Read more

Customize categroy catalog page

content-product_cat.php is the equivalent template for the category thumbnails. You want to copy templates/content-product_cat.php to your theme and modify it, the same way you presumably did for content-product.php. As with the product template, though, the only HTML in the template is the <li> tag. The rest is output through hooks.

How to display custom fields as table in Woocommerce

How are the custom fields saved? If you use ACF – Advanced custom fields, you can use get_field() function to get the variables. This should get you started. You can use another action hook or priority if you want the table to be displayed somewhere else. function display_product_table(){ global $product; ?> <table class=”shop_attributes”> <tr> <th><?php … Read more