Skip to content

Instantly share code, notes, and snippets.

@alexkingorg
Created January 30, 2014 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexkingorg/8713859 to your computer and use it in GitHub Desktop.
Save alexkingorg/8713859 to your computer and use it in GitHub Desktop.
Implode with $wpdb (from: https://coderwall.com/p/zepnaw)
<?php
$results = $wpdb->get_results(
$wpdb->prepare("
SELECT ID, post_title, post_name, post_parent
FROM $wpdb->posts
WHERE post_parent IN (".implode(',', array_map('intval', $post_ids)).")
")
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment