Support » Plugin: WP-PageNavi » not working with custom SWP_Query

  • I use the SearchWP plugin. WP PageNavi seems to work fine on the site-wide search, but breaks on a listing page for a certain post type which has filters applied. If a keyword search is one of the filters, the listing query is done with SWP_Query instead of WP_Query.

    On the site-wide search, wp_pagenavi() is called with the global $wp_query object passed in the query parameter. On the filtered listing, the custom query object is passed. I’m guessing SearchWP modifies the global query for the site-wide search, but PageNavi isn’t set up to deal with a custom SWP_Query object. From the docs:

    SWP_Query is a class available in SearchWP that aims to mimic the functionality of WP_Query to the best of its ability. The class is not feature complete when comparing it to WP_Query and likely never will be. It has its own set of arguments, some match WP_Query and others are specific to SearchWP.

    I guess this might be a case of re-engineering the listing query so it always uses WP_Query (with keyword filtering applied somehow via a query hook, rather than actually calling the custom SWP_Query class). The error I get is:

    Fatal error: Uncaught Error: Call to undefined method SWP_Query::get()
    in/wp-content/plugins/wp-pagenavi/core.php on line 257

Viewing 1 replies (of 1 total)
  • Thread Starter Steve Taylor

    (@gyrus)

    OK, it seems that on previous projects we had to fork WP PageNavi to make it work with SWP_Query – and I’d forgotten to use that forked plugin.

    Working for now but – I think the changes we made in the fork were pretty simple. Any chance of WP PageNavi adding SearchWP support?

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.