Forums Forums Search & Filter Pro archive pages return no results

Tagged: 

Viewing 10 posts - 1 through 10 (of 12 total)
  • Anonymous
    #141521

    I’ve got a relatively simple form inserted onto taxonomy and archive pages. Even when the form is not present on the archive page, it’s perverting the result. This is different from the bug I encountered recently with shared taxonomies (or it should be- these are archive pages).

    The form is super-simple – a single taxonomy dropdown, limited to a single custom post type.

    With the form enabled, but not shown on the archive page, the main query for the post archive looks like this:

    SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
    FROM wp_posts
    INNER JOIN wp_postmeta
    ON ( wp_posts.ID = wp_postmeta.post_id )
    WHERE 1=1
    AND wp_posts.ID IN (2672,5491,5492,5493,5494,5495,5496,5497,5498,5499,5501,5502,5503,5504,5505,5506,5507,5508,5509,5510,5512,5513,5514,5515,5516,5517,5518,5519,5520,5521,5522,5523,5524,5525,5526,5527,5528,5529,5530,5531,5532,5533,5535,5536,5537,5538,5539,5540,5541,5542,5543,5544,5546,5547,5548,5549,5550,5551,5552,5553,5555,5556,5557,5558,5559,5560,5561,5562,5563,5564,5565,5566,5567,5568,5569,5570,5571,5572,5573,5574,5575,5576,5577,5578,5579,5580,5581,5582,5583,5584,5585,5586,5587,5588,5589,5590,5591,5592,5593,5594)
    AND ( ( wp_postmeta.meta_key = ‘_edit_last’
    AND wp_postmeta.meta_value = ” ) )
    AND wp_posts.post_type = ‘accelerate_product’
    AND ((wp_posts.post_status = ‘publish’))
    GROUP BY wp_posts.ID
    ORDER BY wp_posts.post_title DESC, wp_posts.post_type DESC
    LIMIT 0, 10

    The list of post IDs in the wp_posts.ID IN clause are not even from the same CPT the archive is for, they belong to a different CPT. The form does not reference those other post types. If I send the form to the trash, disabling it, the query now looks like this:

    SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
    FROM wp_posts
    WHERE 1=1
    AND wp_posts.post_type = ‘accelerate_product’
    AND (wp_posts.post_status = ‘publish’
    OR wp_posts.post_status = ‘tribe-ea-success’
    OR wp_posts.post_status = ‘tribe-ea-failed’
    OR wp_posts.post_status = ‘tribe-ea-schedule’
    OR wp_posts.post_status = ‘tribe-ea-pending’
    OR wp_posts.post_status = ‘tribe-ea-draft’
    OR wp_posts.post_status = ‘private’)
    ORDER BY wp_posts.post_date DESC
    LIMIT 0, 10

    And the archive now shows posts. the tribe-ea-xxxx meta is related to the Modern Tribe Events Calendar plugin.

    I’m stumped. Tested in 2.3.4 and the 2.4 beta.

    Trevor
    #141531
    This reply has been marked as private.
    Ross Moderator
    #141709

    Hi again Rob

    So to tackle the above.

    S&F will likely be “hijacking” or “rewriting” the query for that page, because you have the display method set to archive and single post type selected. Even if you do not have a search form on display, you’ve effectively told S&F to affect this post type archive with its settings.

    The way S&F builds a query, is slightly unusual, so that query above doesn’t look particularly out of place.

    We build our own query from our cache, and do all the heavy lifting of a query (you will usually find a S&F query, has almost nothing, except a list of post IDs and post type) and then send our IDs to a WP_Query, where WordPress then adds a post type clause to the query.

    I wouldn’t worry that some of hte IDs don’t belong to the right CPT, we could have filtered out the post type at this stage, but we’ve found in our testing, the fastest way to do this is to allow WP to simply ignore the IDs that are not needed, because of the post_type clause in all WP_Query’s.

    Anyway, to get back round to the task at hand.

    As you know from my previous reply, filtering in taxonomy archives is currently only officially supported where the taxonomy belongs to one post type.

    My suspicion is that these shared taxonomies are causing some issues, and S&F is jumping in and modifying queries where they are related to these shared taxonomies, but not related to the specific post type you have chosen in S&F settings.

    If you could provide more info such as a link and admin then I could verify this to be the case.

    Hope that helps.

    Best

    Anonymous
    #141789
    This reply has been marked as private.
    Ross Moderator
    #142006
    This reply has been marked as private.
    Ross Moderator
    #142248
    This reply has been marked as private.
    Anonymous
    #142284
    This reply has been marked as private.
    Ross Moderator
    #142422
    This reply has been marked as private.
    Anonymous
    #142758
    This reply has been marked as private.
    Ross Moderator
    #143307
    This reply has been marked as private.
Viewing 10 posts - 1 through 10 (of 12 total)