WordPress.org

Forums

[resolved] looking for a function similar to get_post that accept arrays (3 posts)

  1. holidaymaine
    Member
    Posted 4 years ago #

    Hi all!
    I have a site the allows users to post content and each post is related to a taxonomy term. I want to create email groups by the authors of each post relating to a term. I am using get_objects_in_term() to get the array of post related to a term.

    The problem I am having is get_post() only accepts a single integer. I search everywhere for a better function, but had no luck finding one.

    So, here I am asking for help to locate a function similar to get_post() that accepts arrays or if anyone has any ideas of a better way to accomplish this.

    Thanks in advance and any input is appreciated.

  2. alchymyth
    Forum Moderator
    Posted 4 years ago #

    try and convert the array into a comma-separated string and use the 'include' parameter of 'get_posts()'

    http://php.net/manual/en/function.implode.php
    http://codex.wordpress.org/Template_Tags/get_posts

    or look into using WP_Query() and the 'post__in' parameter with the array.

    http://codex.wordpress.org/Function_Reference/WP_Query

  3. holidaymaine
    Member
    Posted 4 years ago #

    thank you. Implode is exactly what I needed.

Topic Closed

This topic has been closed to new replies.

About this Topic