WordPress.org

Ready to get started?Download WordPress

Forums

404 on search pagination, but not paginated taxonomy? (3 posts)

  1. Leo Blanchette
    Member
    Posted 1 year ago #

    Am I writing this query correctly? I'm trying to get paginated results for a custom taxonomy off of the search page.

    Search works fine on the taxonomy page, but a search page gives a 404 on page 2.

    if ( is_search() ) {
                $image_tags = get_query_var( 's' );
    
            } else {
                $image_tags = get_query_var( 'image-tags' );
            }

    Then I determine the search attributes -

    if ( is_tax( 'image-tags' ) || is_search() ) {
                $tax_query = array(
                     array(
                         'taxonomy' => 'image-tags',
                        'field' => 'name',
                        'terms' => explode( ' ', $image_tags ),
                        'operator' => 'AND'
                    )
                );
            }

    Then this is what gets sent to the WP_query class

    $local_query = array(
    	    'post-type' => 'image',
                'paged' => $paged,
                'tax_query' => $tax_query,
    
            );

    I truly hope someone might have some guidance. I've been on this for a loonggg time now. Answers on wordpress forums have not been forthcoming...I suspect its a hard problem.

  2. Leo Blanchette
    Member
    Posted 1 year ago #

    LOL Finding my own questions on google. Still unanswered.

  3. openwp3
    Member
    Posted 1 year ago #

    Same here Leo. I have a similar issue and not getting any responses. Here are a few posts I found that might be of help to you:

    http://wordpress.org/support/topic/custom-loop-pagination?replies=4

    http://developer.wordpress.com/2012/05/14/querying-posts-without-query_posts/

Topic Closed

This topic has been closed to new replies.

About this Topic