Support » Plugin: Easy Property Listings » Pre Get Posts – Causes Error with ACF

  • Resolved mikeschut

    (@mikeschut)


    When using this plugin you have a function that is a little to open and not specific enough. I had to create the function below to remove your function and then add back in what you code was doing with a minor update to specifically only update the “paged” for your post types.

    File Location: PLUGIN_ROOT/lib/includes/template-function.php
    Lines: 1709 – 1715

    If possible could you please update this function to only affect the post types that are created with your plugin. This will resolve the error your plugin is causing with other plugins like Advanced Custom Fields on paginated pages. Thanks for your help!

    
    function fix_easy_property_listings_error( $query ){
    	remove_action('pre_get_posts','epl_home_pagination_fix');
    	
    	$post_types_sold 	= array('property','land', 'commercial', 'business', 'commercial_land' , 'location_profile','rural');
    	$post_types_rental 	= array('rental');
    	
    	global $wp_query;
    	if( isset($wp_query->query['paged']) && (in_array($query->query_vars['post_type'], $post_types_sold) || in_array($query->query_vars['post_type'], $post_types_rental)) )
    		$query->set('paged', $wp_query->query['paged']);
    }
    add_action('pre_get_posts', 'fix_easy_property_listings_error', 0);
    
    • This topic was modified 5 years, 1 month ago by mikeschut.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Pre Get Posts – Causes Error with ACF’ is closed to new replies.