How to search usermeta table

This works: $WhoIsUser = get_users( array( ‘meta_key’ => ‘deviceid’, ‘meta_value’ => ‘45545’ ) ); This returns the whole row for that user from the users table. If you print_r it out like so: echo ‘<pre>’ echo print_r($WhoIsUser, TRUE); echo ‘</pre>’ you get: Array ( [0] => WP_User Object ( [data] => stdClass Object ( [ID] … Read more

Filter multiple dynamic dropdown lists within one form using the Smart Grid-layout extension for Contact Form 7

Try this instead, combine all 3 functions into a single one, add_filter(‘cf7sg_dynamic_dropdown_custom_options’, ‘filter_options’,10,3); function filter_options($options, $field_name, $form_key){ //field ‘dynamic_select-461’ if($form_key == ‘bez-nazvu’ && $field_name == ‘dynamic_select-461’) { $options = array(); //get your terms $terms = get_the_terms( $post->ID , ‘strava’ ); if( ! empty( $terms ) && ! is_wp_error( $term_args ) ) { foreach( $terms as … Read more

Populate select list with meta values from all posts of a Custom Post Type

Here is the solution I came up with, that works properly. <form method=”get” action=”” onchange=”submit();”> <div class=”input-group”> <?php global $wpdb; $meta_key = ‘item_oem’; $data = $wpdb->get_results($wpdb->prepare( “SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = %s”, $meta_key) , ARRAY_N ); ?> <select class=”custom-select” id=”oems” aria-label=”oems” name=”item_oem” > <option selected>Search By OEM</option> <?php foreach( $data as $value … Read more