WordPress REST API Search decoded URL with cyrillyc symbols
WordPress REST API Search decoded URL with cyrillyc symbols
WordPress REST API Search decoded URL with cyrillyc symbols
I got this working through the following combination of functions (credit to this post): function search_join_custom( $join ) { global $wpdb; if ( is_search() ) { $join .=’ LEFT JOIN ‘.$wpdb->postmeta. ‘ ON ‘. $wpdb->posts . ‘.ID = ‘ . $wpdb->postmeta . ‘.post_id ‘; } return $join; } add_filter(‘posts_join’, ‘search_join_custom’ ); function search_where_custom( $where ) … Read more
Sorry, it’s unclear to me what your goal is, if you could clarify your question more and additional information like what kind of options you’re trying to use (are they custom fields, are they categories, tags, or other taxonomies, or another characteristic like post author?) First, the select inputs should not have blank name values. … Read more
how to make search with two input boxes
There are two name‘s: The name query variable The name attribute in an input tag The Query Variable name represents the post slug. For example, I have a blog post on my site: https://tomjn.com/2018/07/23/deployment-and-wordpress/ It has this post name: deployment-and-wordpress I can also visit this URL: https://tomjn.com/?name=deployment-and-wordpress I could also find it via WP_Query in … Read more
Take a look at https://developer.wordpress.org/reference/classes/wpdb/get_col/ On your result page, receive the query as follows <?php if(isset($_POST[‘name’]) || isset($_POST[’email’])){ $name=”%” . $wpdb->esc_like( $_POST[‘name’] ) . ‘%’; $email=”%” . $wpdb->esc_like( $_POST[’email’] ) . ‘%’; global $wpdb; $prepare = $wpdb->get_col( $wpdb->prepare( ” SELECT post_id FROM “.$wpdb->prefix.”postmeta AS M WHERE M.meta_value LIKE ‘%s’ OR M.meta_value LIKE ‘%s’ “, $name, … Read more
Yes. You can use native WordPress feeds, or you can create your own feed, e.g. with only the title and link to each post. Than you can access this feed from the other domain. You will also have to update your search results template accordingly. It gets a bit more tricky if you use some … Read more
If you want to exclude the “product” post type (= WooCommerce products) from all front-end searches on your site, you can use this code: function my_adjust_post_type_args( $args, $post_type ) { if ( ‘product’ === $post_type ) { $args[‘exclude_from_search’] = true; } return $args; } add_filter( ‘register_post_type_args’, ‘my_adjust_post_type_args’, 10, 2 ); It modifies the “exclude_from_search” argument … Read more
To do it in query handling stage, may use request hook which is when WordPress query is being setup. The term link is recommended by @Jacob Peattie using built-in get_term_link() instead of building it manually for more flexibility and error-proof. add_filter( ‘request’, ‘ws366006_check_request_query’ ); function ws366006_check_request_query( $query ) { // var_dump($query); // redirect checking if( … Read more
It appears your search is going to https://youthtalkedinburgh.co.uk/?post_type[]=&s=sport instead of the (more proper) https://youthtalkedinburgh.co.uk/?s=sport, which works. Looking at the source, it appears your search form looks like this (simplified): <form … > <input type=”hidden” name=”post_type[]” value=””> <input name=”s”… > … </form> That <input type=”hidden” name=”post_type[]” value=””> input field doesn’t seem to belong. I suspect either … Read more