No header/footer/global block found

Hi guys, this problem started happening with PRO as soon as the new features were shipped and the pro menu became entirely “front-end” rendered.

The problem is that out of a sudden, all my headers, footers, global blocks seem to be gone and i get the following: https://prnt.sc/136d1ip

However, the content does exist since i can access them if i have the URL which is what i do right now (i have to look for it in the database and access it manually)

It’s not something we would like to have because some of our clients like to create their own stuff and now they can’t because of it.

This is happening to most of our websites (All use pro and most of them have been using PRO since v1) so we would really like to know what’s going on and how we can fix it.

I have set up a staging site for you already in minimal installation. do with it what you want, it’s all yours :wink:

We don’t really know what we can try here, in this website things worked ok until we changed the header, then everything just “disappeared”.

EDIT: it looks like the problem is the same as this one: Header, Content & Footer assets not found

we also have full control over our server (it’s a VPS managed entirely by us) so if you want us to check something there, go ahead and ask.

Nevermind. we found the cause although we don’t really understand why and if you can let us know what a code like the below could do to your framework, we’ll take it into consideration next time we write any code for our clients.

function fa_search_filter($query) {
			if ( ! is_admin() ){
				if ($query->is_search) {
					$query->set('post_type', 'product');
				}
				return $query;
			}
		}
		add_filter('pre_get_posts','fa_search_filter');

In order to have it working again we had to fix the above code to:

function fa_search_filter($query) {
			if ( ! is_admin() && $query->is_main_query() ){
				if ($query->is_search) {
					$query->set('post_type', 'product');
				}
				return $query;
			}
		}
		add_filter('pre_get_posts','fa_search_filter');

however, we’re now wondering if this could still affect something else on your framework :sweat:

Hello @franticape,

It’s good to know that you have found a way to resolve the issue. The first code will be applied whether you are logged in or not. The second one is the correct one which will only affect the main query for your site.

Cheers.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.