adjusting regex
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 23 Nov 2015 21:06:37 +0000 (16:06 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 23 Nov 2015 21:06:37 +0000 (16:06 -0500)
search.php

index 357b357..5a7175f 100644 (file)
@@ -37,8 +37,9 @@
 
                                 // Load content as plain text
                                 global $wp_query, $post;
+                                $content  = preg_replace('/[\n\r]+/', '', $content);
                                 $content = (!post_password_required($post) ? strip_tags(preg_replace(array("/\r?\n/", '@<\s*(p|br\s*/?)\s*>@'), array(' ', "\n"), apply_filters('the_content', $post->post_content))) : '');
-                               $content  = preg_replace('/[\n\r]+/', '', $content);
+                              
                                 // Search content for terms
                                 $terms = $wp_query->query_vars['search_terms'];
                                 if ( preg_match_all('/'.str_replace('/', '\/', join('|', $terms)).'/i', $content, $matches, PREG_OFFSET_CAPTURE) ) {