• Resolved Marc T?nsing

    (@marcdk)


    Hi!

    Is there a function where I can get a list of related postids by postid?

    something like:

    yarpp_get_related_posts(post_id){

    //magic

    return $array_of_related_postids;
    }

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Marc T?nsing

    (@marcdk)

    Found it:

    $related_posts_array = array();
    $related_posts = yarpp_get_related(array(),$cpid);
    
    foreach ($related_posts as $posts) {
       $related_posts_array[] = $posts->ID;
    }
    
    var_dump($related_posts_array);
    • This reply was modified 4 years, 9 months ago by Marc T?nsing.
    Plugin Support Michael Nelson

    (@mnelson4)

    Glad you figured it out @marcdk. For now that’s probably the best way to do that.

    Thread Starter Marc T?nsing

    (@marcdk)

    Thank you for confirming this. I did no measure any performance difference with a microtime test. Is the result of yarpp_get_related() cached? The readme says “no”.

    Plugin Support Michael Nelson

    (@mnelson4)

    Kind of. The first time you run the query, it actually evaluates relatedness with all applicable posts, then stores the results in YARPP’s custom table for quicker reference all subsequent requests. It just doesn’t use WordPress’ normal caching functions for that.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘YARPP – get related post ids by postid?’ is closed to new replies.