• Still a bit new to coding in WordPress but I’m left scratching my head on this…

    After spending a number of hours tbshooting why only the first category was excluded when I called the get_adjacent_posts() like this:

    $prevPost = get_adjacent_post(false,'30,31,32,410',true);

    I opened up the code’s core library link-template.php and find the delimiter for the exclude category list should be ” and ” so that now this actually works:

    $prevPost = get_adjacent_post(false,'30 and 31 and 32 and 410',true);

    On the codex pages for get_adjacent_post() and related get_next_post()/get_previous_post() functions this delimiter isn’t documented from what I could see.

    Is the ” and ” delimiter common practice in WordPress for delimiting category or tag IDs in functions? Seems like an odd delimiter not to be documented unless if I was more experienced I’d know this was common WP practice.

    Thanks for any feedback on this one.

    David

Viewing 1 replies (of 1 total)
  • PoMa

    (@pornomagnatas)

    Thank God and toyNN… It works. Almost spend an hour searching for solution…

    I will add here more keywords, so more users will be able to find it:


    get_adjacent_post exclude multiple
    , exclude multiple categories, syntax

Viewing 1 replies (of 1 total)
  • The topic ‘get_adjacent_posts exclude category syntax’ is closed to new replies.