Search query alteration not working for meta values
Search query alteration not working for meta values
Search query alteration not working for meta values
Dynamically added text at bottom of article – non searchable by PHP code
Making ACF fields appear in search results
The user password (stored as an MD5 hash) can be retrieved like so: $users = get_users(); foreach ( $users as $user ) { $password = $user->user_pass; } Assuming you have some known value for passkey, you can hash it and compare it to each user’s password: $passkey = ‘somestring’; $hashed_passkey = md5( $passkey ); $users … Read more
WP search is rather simplistic. After some processing on search query, it adds condition to SQL query looking for LIKE (contains) match in title or post content. So natively assigned taxonomies are not searched. So you will either have to use additional code (or third party plugin) or use third party search solution (Google Custom … Read more
I’ve used code like this, based (extremely) loosely on the plugin relevanssi: (in “functions.php”) // Roughly based on the relevanssi_do_excerpt() (https://wordpress.org/plugins/relevanssi/, GPLv2 or later), seriously simplified. function mytheme_search_context( $haystack, $needles, $len = 30 ) { $ret=””; $haystack = strip_tags(mytheme_strip_invisibles($haystack)); $haystack = trim( preg_replace( array( “/\n\r|\r\n|\n|\r/”, ‘/\s\s+/’, ‘/&.{1,30}?;/’ ), ‘ ‘, $haystack ) ); $words = … Read more
Maybe it´s easier to output some content from a different page/post in your search template which got a fixed slug. I for example use this: $page = get_posts(array(‘name’ => ‘welcome’)); if ($page) { echo ‘<h1>’.$page[0]->post_title.'</h1>’; echo ‘<p>’.$page[0]->post_content.'</p>’; } This fetches the post with the slug “welcome” and displays its content. As I don´t use a … Read more
How to make WordPress search.php display all strings found on pages or posts
I found that WordPress added an extra space. <ul class=”sub-menu”> so the search and replace could not be done correctly. If you look in the code inspector (developer tools) you won’t see the extra space. Once going to view source code (command + shift + U), I noticed the actual output code had the extra … Read more
We can set the author_url argument of WP_Comment_Query as null (empty string will not work) to search for comments that don’t have an author url. Currently (ver 4.8.1) the has_author_url isn’t supported. Using a sub-query to exclude those comments, with no author_url, using comment__not_in, should work, but wouldn’t probably scale well. Setting fields as ids … Read more