Title: Return only Post IDs
Last modified: September 17, 2017

---

# Return only Post IDs

 *  Resolved [johaan89](https://wordpress.org/support/users/johaan89/)
 * (@johaan89)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/return-only-post-ids/)
 * Is there a function that ONLY returns the related post’s IDs?
 * Looked over the docs and there doesn’t seem to be anything related to it unless
   I missed something
 * Trying to load them over Ajax but I only need the related post IDs to be returned.
    -  This topic was modified 8 years, 8 months ago by [johaan89](https://wordpress.org/support/users/johaan89/).
    -  This topic was modified 8 years, 8 months ago by [johaan89](https://wordpress.org/support/users/johaan89/).
    -  This topic was modified 8 years, 8 months ago by [johaan89](https://wordpress.org/support/users/johaan89/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [johaan89](https://wordpress.org/support/users/johaan89/)
 * (@johaan89)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/return-only-post-ids/#post-9508517)
 * Nevermind did some custom code since there’s no function built into the plugin
   to retrieve posts IDS
 * Picking up a premium license since I like the results it produces with its tag,
   title algorithm
 * should probably make it easier to retrieve post ids though, even if it’s premium
   only.
    -  This reply was modified 8 years, 8 months ago by [johaan89](https://wordpress.org/support/users/johaan89/).
    -  This reply was modified 8 years, 8 months ago by [johaan89](https://wordpress.org/support/users/johaan89/).
 *  [Ferghus](https://wordpress.org/support/users/ferghus/)
 * (@ferghus)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/return-only-post-ids/#post-10067580)
 * For anyone else who needs this:
 * function hi_get_related_posts( $post_id ) {
    $pl_manager = new RP4WP_Post_Link_Manager();
   $related_posts = $pl_manager->get_children( $post_id );
 *  $related_ids = array();
    foreach ( $related_posts as $post ) { $related_ids[]
   = $post->ID; }
 *  return $related_ids;
    }

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Return only Post IDs’ is closed to new replies.

 * ![](https://ps.w.org/related-posts-for-wp/assets/icon-256x256.png?rev=970117)
 * [Related Posts for WordPress](https://wordpress.org/plugins/related-posts-for-wp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/related-posts-for-wp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/related-posts-for-wp/)
 * [Active Topics](https://wordpress.org/support/plugin/related-posts-for-wp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/related-posts-for-wp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/related-posts-for-wp/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Ferghus](https://wordpress.org/support/users/ferghus/)
 * Last activity: [8 years, 2 months ago](https://wordpress.org/support/topic/return-only-post-ids/#post-10067580)
 * Status: resolved