Elasticpress: [BUG] Facets and paginated archives

Created on 19 Mar 2019  路  5Comments  路  Source: 10up/ElasticPress

There's a problem with Facets:

Steps to reproduce:

  1. Go to /page/2/ of any archive.
  2. Click a facet that doesn't have enough posts to fill 2 pages.
  3. you get 404. (/page/2/) doesn't exist.

----------My take on this-------------
When a facet is clicked it should remove the paged query (back to page 1). It's wrong to carry it over, it may not exist. I hope this can be fixed. Thanks.

confirmed bug

Most helpful comment

Confirmed this. Thanks @Salamander3 for letting us know

All 5 comments

This is my dirty cheap fix until this get addressed. Place this code on 404.php on your WP template:

<?php 
$url = $_SERVER['REQUEST_URI'];

if (strpos($url, '/page/') !== false) {
    $url2 = preg_replace("/\/page\/[0-9]{1,3}/",'',$url);
    header('Location: '.$url2);         
}
 ?>

It's so dirty you might need to shower after using it, but it works.

Confirmed this. Thanks @Salamander3 for letting us know

Just pushed a fix @Salamander3 , could you test if you have some time ?

@oscarssanchez I'm sorry i was away. Back now, How can i get the fix for testing?

Yes that fixes it. Thanks. Please add https://github.com/10up/ElasticPress/pull/1347 to the next version of the plugin.

Was this page helpful?
0 / 5 - 0 ratings