• Resolved slamsal

    (@slamsal)


    Hi there,
    So far the plugin seems to run when the post (let’s say post-ID 1234) is viewed. So, after the post is published but not viewed; if I check-up in a database, it doesn’t appear but when I load a post in the frontend, and refresh the database in PHPMyAdmin, it finally shows up. My question is it possible to directly trigger this without viewing a post?
    I’m using WP database as my backend to Node.js application. So, it is not realistic for me to view every post in WP. I’ve my cronjobs set directly in server and have disabled the default WP Cron. How can I solve this?
    Thank you!

Viewing 1 replies (of 1 total)
  • Plugin Support Michael Nelson

    (@mnelson4)

    @slamsal you’re assessment is right, YARPP avoid calculating related posts until the first time a visitor views the post.
    If you want to do more eager caching of related posts, you have a few options:
    * in PHP, call $yarpp->display_related($post_id,array(),false)
    * or, from any server, send an HTTP request to the REST API endpoint yoursite.com/wp-json/yarpp/v1/related/{post_id}

    You of course also have options about when to do either of those things:
    * in PHP, you could listen for WordPress action publish_post (See https://codex.www.ads-software.com/Plugin_API/Action_Reference/publish_post)
    * or on a cron, you could write a script to just ping all your posts periodically (probably not the most efficient option)

    Does that make sense? I hope it helps!

Viewing 1 replies (of 1 total)
  • The topic ‘Trigger YAARP when the post is published’ is closed to new replies.