WordPress.org

Support

Support » How-To and Troubleshooting » 404 on search pagination, but not paginated taxonomy?

404 on search pagination, but not paginated taxonomy?

  • Leo Blanchette

    @leoclipartillustrationcom

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘404 on search pagination, but not paginated taxonomy?’ is closed to new replies.