• Resolved johaan89

    (@johaan89)


    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 7 years, 2 months ago by johaan89.
    • This topic was modified 7 years, 2 months ago by johaan89.
    • This topic was modified 7 years, 2 months ago by johaan89.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter johaan89

    (@johaan89)

    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 7 years, 2 months ago by johaan89.
    • This reply was modified 7 years, 2 months ago by johaan89.

    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.