Woocommerce Backend Search by Title and SKU

Please try this code function search_by_sku( $search, &$query_vars ) { global $wpdb, $pagenow; if ( ‘edit.php’ != $pagenow || ! is_search() || ! isset( $query_vars ->query_vars[‘s’] ) || ‘product’ != $query_vars ->query_vars[‘post_type’] ) { return $search; } if(isset($query_vars->query[‘s’]) && !empty($query_vars->query[‘s’])){ $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘product’, ‘meta_query’ => array( array( ‘key’ => … Read more

Loading a plugin’s js file from functions.php

It feels slightly fragile, but you can probably just do: wp_scripts()->add_data( ‘gpvb-admin-scripts’, ‘group’, 1 ); in a low-priority admin_enqueue_scripts hook, since that’s what wp_register_script does with the $is_footer flag. However this risks a future version of WordPress changing how this is saved internally (although it’s been stable for 5+ years). Alternatively you could query for … Read more

WordPress Stock Update Programatically

WordPress stores three levels of stock information on the wp_postmeta. Each product has manage stock enabled Stock Quantity Stock Status Since the products on the above questions were imported, few of them didn’t had manage stock enabled so updating the stock quantity to 0 didn’t work well. Solution: I forcefully updated the manage stock to … Read more

I receive taxonomy id

there is a mistake in fetching the product attribute name. first of all, we have to get all options ids & attribute names than we have to fetch attribute name by its id & attribute slug. please check below updated code snippet and let me know if this is worked for you or not.if not … Read more

Get site url and updates data, then use them

First of all you should perform $updates = wp_get_update_data(); in the wp_footer() body because till then you don’t have access to $updates variables. add_action( ‘wp_footer’, ‘my_function’ ); function my_function() { $updates = wp_get_update_data(); echo $updates[‘title’]; }

New bulk action to resend welcome emails

I don’t think the plugin is helpful for your case, and you can just call the WordPress API yourself directly: wp_new_user_notification( $user_id, null, ‘both’ ); This is all the plugin does: get’s the user ID from request parameters, verifies the user exists and then calls wp_new_user_notifications (see plugin code here).