Zdvojené výsledky hledání – oprava
Zdvojené výsledky hledání článků zařazených do více kategorií
Po upgrade na 2.2.2. dochází v kombinaci s pluginem Events Calendar k chybnému vypsání vyhledaných příspěvků pro každou kategorii znovu a znovu, př. článek máme v šesti kategoriích, ve výsledcích hledání je tedy také šestkrát. Řešení je naštěstí jednoduché, viz. níže uvedený zdroj.
WordPress › Support » Search results duplicated if in more than one category (2.1)
Question: With WP 2.1 a search will now repeat a post found through a search as many times as it has categories.
So, for example, if I have a post tagged under 'technology', 'science' and 'sport', any search where that is a result will display the post three times. This didn't happen with previous versions. Any idea about a hack to only ever display a search result once? Thanks.
Answer: I've no problem with Event Calendar working with 2.1 and made the following change in eventcalendar3.php to get rid of the problem in function 'ec3_filter_posts_where' add the following to the first if statement:
-
|| $wp_query->is_search








