Support » Plugin: YARPP - Yet Another Related Posts Plugin » yarpp_related() does not return all posts

  • Resolved franciscus

    (@franciscus)


    I am using YARPP 5.22.0.
    I call yarpp_related() from my custom post_type templates. Depending on the custom post_type, I call it with different values of $args[‘post_type’]. E.g.

         'typeA': $args['post_type'] = array('typeA', 'typeB');
         'typeC': $args['post_type'] = array('typeC');

    etc.
    yarpp_related indeed returns only posts of the requested type(s), but the search it performs does not take that argument into account. As a result, it finds too few related posts of the requested type(s). It looks like the following happens:
    1) YARPP fills the cache using the default post types configured in Admin (or ALL post types if no defaults configured)
    2) YARPP queries the cached results, and returns only those that match $args[‘post_type’]
    This is not correct behaviour.

    Below is the stack trace down to the routine that performs the query with “all post types”

    YARPP->get_query_post_types (d:\hg\local.animaplates.com\wp-content\plugins\yet-another-related-posts-plugin\classes\YARPP_Core.php:990)
    YARPP_Cache_Tables->sql (d:\hg\local.animaplates.com\wp-content\plugins\yet-another-related-posts-plugin\classes\YARPP_Cache.php:258)
    YARPP_Cache_Tables->update (d:\hg\local.animaplates.com\wp-content\plugins\yet-another-related-posts-plugin\classes\YARPP_Cache_Tables.php:229)
    YARPP_Cache_Tables->enforce (d:\hg\local.animaplates.com\wp-content\plugins\yet-another-related-posts-plugin\classes\YARPP_Cache.php:68)
    YARPP->display_related (d:\hg\local.animaplates.com\wp-content\plugins\yet-another-related-posts-plugin\classes\YARPP_Core.php:1276)
    yarpp_related (d:\hg\local.animaplates.com\wp-content\plugins\yet-another-related-posts-plugin\includes\related_functions.php:23)

    Also, there seems to be an attempt at caching the results of yarpp_related(), in spite of the documentation. I am actually quite happy about that 🙂

    • This topic was modified 12 months ago by franciscus.
    • This topic was modified 12 months ago by franciscus.
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘yarpp_related() does not return all posts’ is closed to new replies.