If you are using FacetWP and Elementor you may run into a conflict where FacetWP stops working on custom queries. This is due to a conflict with Elementor. To fix it you can disable Elementor but that isnt a great solution if you are using it. Instead, go into the settings within Elementor and then the “Features” tab. Scroll down to “Optimize Image Loading” under “Experiments” and disable this feature. This should get FacetWP working again.

Here is an example of a query using FacetWP that wasn’t working but I was able to fix after following the above instructions:

				<?php echo do_shortcode('[facetwp facet="search_posts"]');?>
				<?php echo do_shortcode('[facetwp facet="reset_search"]');?>

	

				<div class="facetwp-template">
					<?php
					$args = array(
					    'post_type' => 'post',
					    'posts_per_page' => 20, 
					    'post_status' => 'publish', 
					    'facetwp'        => true,
					);

					$query = new WP_Query($args);

					if ($query->have_posts()) :
					    while ($query->have_posts()) :
					        $query->the_post();?>

				      <h1><?php the_title(); ?></h1>
				      <div><?php the_content(); ?></div>

					   <?php endwhile;
					    wp_reset_postdata(); // Restore the global post data.

					else :
					    // No posts found.
					endif;
					?>
				</div>

Leave a Reply

Get in Touch

Please fill out the form below and we will get back to you ASAP

  • This field is for validation purposes and should be left unchanged.