Clear all

Top menu missing in search result page  



In the latest update, the top menu is missing in the search result page. Any ideas?

I added
$query->set('post_type', 'post'); //do not search for pages

to limit search results to posts only, then the menu bar is missing

2 Answers

Hello Chi Yuen Tseung, 

Thank you for your question. I am sorry, we were not able to understand your question. 

Query $query->set('post_type', 'post'); will only impact on main query but it has nothing to do with top header. 

Do you mind to elaborate your question & share your website address? 

Have a great day.



I added a piece of code using  "Code Snippets" plug-in to limit the search result to "Posts"(exclude Pages and other types) only:


function fb_filter_query( $query, $error = true ) {

if ( is_search() ) {

$query->set('post_type', 'post'); //do not search for pages



add_action( 'parse_query', 'fb_filter_query' );


I am sorry my site is a closed site I can only share you the screenshots:

Attachment removed

Browse our handcrafted free & pro themes.

Get things done easily with our custom crafted services.

Fall in love with our friendly support team.