Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you want to simply inspect what's being returned by this function, simply include this line after the query is executed:</p> <pre><code>var_dump($postsID); </code></pre> <p>If you want to do <em>something</em> with the data, that can be done many ways, but it depends on what, exactly you want to do; there are too many options to go into in this forum.</p> <p><strong>UPDATE:</strong> Based on the conversation in the comments below, it looks like you want to pass the keys of the results (<code>$postsID</code>) to the $wpdb->get_posts() function.</p> <p>If <code>get_posts()</code> just takes a unique ID as the parameter here's what you have to do:</p> <pre><code>// I'm assuming a simple key=&gt;value pair in your array. Modify your code as needed foreach($postsID as $id) { $result = $wpdb-&gt;get_posts($id); // code that will do "something" with $result } </code></pre> <p><strong>UPDATE 2:</strong> Since <code>$postsID</code> looks like this: array(5) { [0]=> object(stdClass)#4015 (23) { ["ID"]=> string(3) "779" ["post_author"]=> string(2) "12" ["post_date"]=> string(19) "2012-07-27 08:53:22" ["post_date_gmt"]=> string(19) "2012-07-27 08:53:22" ["post_content"]=> string(356) "Text" ["post_title"]=> string(58) "Продам 2-к квартиру Русское Поле" ["post_excerpt"]=> string(0) "" ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(162) "%d0%bf%d1%80%</p> <p>You're going to need to take the ID from each object and insert it into a temp array and pass it to <code>get_posts()</code>:</p> <pre><code>// $args = array( 'post__in' =&gt; array(779,772,768,761,716) ); $tempArr = array(); foreach ($postsID as $obj) { $tempArr[] = $obj-&gt;id; } $args = array('post__in' =&gt; $tempArr); $result = $wpdb-&gt;get_posts($args); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload