Woocommerce membership plugin : include custom field in admin search

I had a hard time finding how to add custom field to admin search under woocommerce > members list. The woocommerce membership plugin is in fact using the ‘posts_clauses’ filter to filter the search result. So to add custom fields, here is the code I use :   function advanced_admin_custom_search($pieces, WP_Query $wp_query) { global $wpdb; Woocommerce membership plugin : include custom field in admin search

ACF how to update field link

To update field link, we have to use an array : <?php $site = array( ‘title’ => $my_title, ‘url’ => $my_url, ‘target’ => “_blank”, ); update_field(‘site’, $site, ‘user_’ . $user_id); ?>  

wordpress filter set-screen-option not working

I recently tried to use screen options for a wordpress backend plugin. I wanted to use a per page variable to be able to easily manage a number of users to request. I first init the screen options : add_action(‘my_plugin_slug’, array( $this, ‘screen_set_option’)); function screen_set_option() {     add_screen_option(‘per_page’, array(     ‘default’=>10,     wordpress filter set-screen-option not working

woocommerce membership and subscription plugin snippet

Get membership object from user id function get_membership($user_id) { return wc_memberships()->get_user_memberships_instance()->get_user_memberships( $user_id )[0] ??null; } Get member id from user id function get_member_id($user_id) { if (get_membership($user_id)) return get_membership($user_id)->get_id(); else return null; } Get subscription id from member id function get_subscription_id($member_id) {      $subscription_id = get_post_meta( $member_id, ‘_subscription_id’, true );      return $subscription_id; } woocommerce membership and subscription plugin snippet

Imagin’home

Imagin’Home est un service sur-mesure pour concevoir votre bien immobilier selon ses besoins et ses envies.