X Pro conflicts with "pre_get_posts" filter with "$query->set ... etc."

So, I was having problems with seeing headers/footers/global blocks.

X Pro 4.011 has conflicts with the following pre_get_posts and query set as shown below:

add_filter('pre_get_posts', 'searchfilter');

function searchfilter($query)
{


		if ($query->is_search() && !is_admin()) {

			$query->set('post_type', array('novel'));
		}
	

	return $query;
}

I changed it to:

add_filter('pre_get_posts', 'searchfilter');

function searchfilter($query)
{


		if ($query->is_search() && !is_admin() && is_search()) {

			$query->set('post_type', array('novel'));
		}
	

	return $query;
}

Fixed the issue. But this shows that there is a conflict with $query->set. It’s quite likely that however Pro is built, anything that sets a query in their project will override the X Pro if it’s not limited outside the builder.

Hi @JfantasyBooks,

Unfortunately, the mentioned issue can’t be replicated at our end, can you please mention the exact conflict which you are having with pre_get_posts? It helps us to recognize the cause of the problem.

Thanks

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