Backend users list – add Woocommerce meta to table

All the code below is for your current theme functios.php file (but better use a child theme or a custom plugin). Step 1. Not sure if you figured out with adding the columns, but I will mention it too – use manage_users_columns hook. add_filter( ‘manage_users_columns’, ‘new_modify_user_table’ ); function new_modify_user_table( $columnnames ) { return array_slice( $columnnames, … Read more

How to add existing categories into a post using wp_insert_post

You can use wp_set_object_terms() to assign taxonomy terms to a post. wp_set_object_terms($post_id, $terms, $taxonomy, true); Where $terms – A single term slug, single term id, or array of either term slugs or ids. Will replace all existing related terms in this taxonomy. See documentation: https://codex.wordpress.org/Function_Reference/wp_set_object_terms Edit: In your case, it will look like: wp_set_object_terms($post_id, array(2,3,4,5), … Read more

Filtering variable WooCommerce products by stock level using meta_query

you are not showing $quantity, maybe that is off? this one here definitely works: $args = [ ‘post_type’ => ‘product_variation’, ‘posts_per_page’ => 100, ‘meta_query’ => [ [ ‘key’ => ‘_stock’, ‘value’ => 0, ‘compare’ => ‘>’, ‘type’ => ‘NUMERIC’ ] ] ]; $query = new WP_Query($args); with this query, you get all variations, that are … Read more

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