How to search through pdf media files?

The built in WordPress search doesn’t index PDF file contents, however Google does, there’s a good tutorial on DevPress on replacing WordPress search with Google Custom Search.

How to exclude post body from WP search

To remove elements from being searched, use the post_search filter to amend the SQL query for the search e.g. only pull in the title. function ni_search_by_title_only( $search, &$wp_query ){ global $wpdb; if ( empty( $search ) ) return $search; $q = $wp_query->query_vars; $n = ! empty( $q[‘exact’] ) ? ” : ‘%’; $search = $searchand … Read more

Return all Tags from search results

The global $wp_query object is available before you call have_posts(). All you have to do is running through this object’s posts member with get_the_terms(). Sample function: function get_query_terms( $taxonomy = ‘post_tag’ ) { $list = array (); foreach ( $GLOBALS[‘wp_query’]->posts as $id ) { if ( $terms = get_the_terms( $id, $taxonomy ) ) { foreach … Read more

How to stop _wpnonce and _wp_http_referer from appearing in URL

This issue arrises because of a couple of problems: 1) WP_List_Table::search_box() inserts the default _wpnonce and _wp_http_referer fields by using wp_nonce_field() without giving you the ability to override and say “I’ve already go a nonce field thanks”. 2) You need to use GET as your method of form submission when subclassing WP_List_Table because WP_List_Table::print_column_headers() only … Read more

Create multiple Search functions for posts / custom post types and everything

you can change your search filter to this: function SearchFilter($query) { $post_type = $_GET[‘post_type’]; if (!$post_type) { $post_type=”any”; } if ($query->is_search) { $query->set(‘post_type’, $post_type); }; return $query; } add_filter(‘pre_get_posts’,’SearchFilter’); then on your news search form add : <input type=”hidden” name=”post_type” value=”post” /> on your custom post type listing search form add <input type=”hidden” name=”post_type” value=”customtypename” … Read more

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