Autoprediction / Autocomplete Search with Meta Keys

If you want to show custom field values, you can’t use WP_Query that select posts. It seems to me that the only available way is to write a sql query and execute it in $wpdb. global $wpdb; if ( isset($_POST[‘search’]) == false || empty($_POST[‘search’]) ) wp_send_json_success( $array() ); $s = $_POST[‘search’]; $meta_keys = [‘PLZ’, ‘ort’, … Read more

jQuery UI Autocomplete showing all results

You get all terms because you’re asking for all terms, in fact, the line $tradeList = get_terms(‘trade’); just get all the terms, ignoring the ‘term’ query string passed to file. If you want to get all the terms “filterd” you have to use the string in the query, something like: include_once( ‘../../../wp-load.php’ ); // adjust … Read more

jQuery Autocomplete in WordPress

don’t include WP like that. use $_GET instead: … $(“#tags”).autocomplete(“<?php echo add_query_arg(‘get_my’, ‘terms’, home_url()); ?>”, … theme’s functions.php: add_action(‘template_redirect’, ‘terms_for_autocomplete’); function terms_for_autocomplete(){ if(isset($_GET[‘get_my’]) && $_GET[‘get_my’] == ‘terms’): $terms = &get_terms(get_taxonomies()); foreach ($terms as $term) echo “{$term->name}|{$term->name} ({$term->count} results)\n”; die(); endif; }

Can I disable the auto complete?

I have a solution I tested, and it works. The autocomplete for the tags is currently done via an ajax request to the file admin-ajax.php. The solution I would suggest is to block the processing of the request so that it does not return any result. I would do : function no_tag_suggest() { if( DOING_AJAX … Read more

ACF Relationship Field Search Filtering [closed]

First, read this post to understand my answer Search that will look in custom field, post title and post content You may want to use the acf/fields/relationship/query/ however, when adding the args: $args[‘meta_query’] = array(array( ‘key’ => ‘your_meta’, ‘value’ => $args[‘s’], ‘compare’ => ‘LIKE’, )); you will find that using that query, WordPress will search … Read more

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