What is the correct way to search 3 custom fields only in WordPress?

Are you using Advanced Custom Fields?(ACF?). Relevanssi is a really good plugin which increases the scope of the core WordPress search. Here’s the link: https://wordpress.org/plugins/relevanssi/ It allows users to search for posts via ACF fields attached to them. Once you install the plugin, you can use the following code in your functions.php file to instruct … Read more

How to exclude specific post_type from default search?

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

Redirecting wordpress search query to archive page

Simply make an HTML form in Elementor on the archive page where you want to search. Code: <form class=”zohaib-search-form” role=”search” action=”/courses” method=”get”> <input placeholder=”Search..” name=”s” type=”search”> <button type=”submit”><i class=”fas fa-search”></i></button> **Note:** name property of input should be ‘s’ because the search query is looking for key ‘s’ to get and run it. Replace the action … Read more

Redirect wordpress search query if its a tag

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

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