Disable – Post search field – for non-admin roles in WP dashboard

There is no straight forward documented way of removing the search box in the admin panel’s Post dashboard (wp-admin/edit.php). However, it’s still possible by extending WP_Posts_List_Table class. Additionally, it makes sense that if you remove the search box, you’d also like to disable the search capability all together (based on your requirement). In that case, … Read more

Custom WordPress Excerpt within terms

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

Two Querys in one Search – Category-Tag nightmare – HOW?

“What you’re asking is totally possible” has me way to exited! I wish I had some code examlpe – but in a rage yesterday I deleted everything thinking it would be best with a fresh start. “it sounds like each “Service post” is tagged with it’s State, as well as each neighboring state in a … Read more