WordPress.org

Support

Support » How-To and Troubleshooting » Getting IDs without printing them?

Getting IDs without printing them?

  • There’s something wrong in this code:

    $myQuery = new WP_Query();
    $myQuery->query(‘post_type=page&meta_key=mood&meta_value=frustrated’);
    $myArray = array();
    while ($myQuery->have_posts())
    {
    the_post();
    global $post;
    $myArray[] = $post->ID;
    }
    echo count($myArray);

    On the last line in the while block, I get this error:

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 35 bytes)

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Getting IDs without printing them?’ is closed to new replies.