How do I query a single data value from the wp_metadata table?

You need to use get_post_meta: get_post_meta( $post_id, $key = ”, $single = false ) Retrieve post meta field for a post $post_id (int) (Required) Post ID. $key (string) (Optional) The meta key to retrieve. By default, returns data for all keys. Default value: ” $single (bool) (Optional) Whether to return a single value. Default value: … Read more

Moving the search bar to be in menu bar

I would recommend creating a child theme instead of editing Vogue files directly. If you edit the files directly, and someday you update the Vogue theme, it will overwrite all of your edits. https://www.smashingmagazine.com/2016/01/create-customize-wordpress-child-theme/ It looks like a file called “header-layout-one.php” is where you’ll find the social media icons. To get the search box to … Read more

Search for anything in site

Use mark.js, a jQuery plugin mark.js is such a plugin that is written in pure JavaScript, but is also available as jQuery plugin. It was developed to offer more opportunities than the other plugins with options to: search for keywords separately instead of the complete term map diacritics (For example if “justo” should also match … Read more

Custom search query by category id

Try this code <?php $args = array( ‘s’ => $_REQUEST[ ‘search’ ], ‘cat’ => ‘category_id’, ‘paged’ => $paged ); // The Query $the_query = new WP_Query( $args ); // The Loop while ( $the_query->have_posts() ) : $the_query->the_post(); //inside the loop the_title(); the_content(); endwhile; // Reset Post Data wp_reset_postdata(); ?> Hope this help

Check If search query contains something?

After the question’s update, I think that you need to set the canonical URL: add_action( ‘wp_head’, ‘cyb_search_results_canonical_URL’ ); function cyb_search_results_canonical_URL() { if( is_search() ) { $link = get_search_link(); echo ‘<link rel=”canonical” href=”‘ . esc_url( $link ) . ‘”>’; } } And your problem with duplicated content is fixed.

How to interfere to default search to make it search in custom fields?

You are getting all post because you didn’t pass meta query correctly. Try this below code function add_search_in_custom_fields( $query ) { // check the query type. if ( $query->is_search ) { $meta_array = array( array( ‘key’ => ‘my_key_title’, ‘value’ => $query->query_vars[‘s’] , ‘compare’ => ‘LIKE’, ), ); // set meta query. $query->set(‘meta_query’, $meta_array); }; } … Read more