How do I filter get_adjacent_post to follow the next category by the product category drag & drop screen? Is using get_categories correct? How do I join it into get_adjacent_post?

$post_prev = get_adjacent_post( false, '', true );
$post_next = get_adjacent_post( false, '', false );

$args = array(
    'parent'        => 0,
    'taxonomy'      => 'product_cat'
$categories = get_categories( $args );

1 Answer 1


The get_adjacent_post() function has multiple arguments. The fourth and last one is the taxonomy, which per default is 'category':

$post_prev = get_adjacent_post( true, '', true, 'product_cat' );
$post_next = get_adjacent_post( true, '', false, 'product_cat' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.