Support » Plugin: YARPP - Yet Another Related Posts Plugin » Warning message (YARPP_Cache.php)

  • Resolved sp691

    (@sp691)


    Hi, this message has recently been appearing at the top of all of my pages:

    Warning: join(): Invalid arguments passed in /home/customer/www/[removed my domain name for privacy].com/public_html/wp-content/plugins/yet-another-related-posts-plugin/classes/YARPP_Cache.php on line 325

    How do I fix it? Thanks!

Viewing 15 replies - 1 through 15 (of 15 total)
  • Thread Starter sp691

    (@sp691)

    In follow up, I contacted my host (Siteground) about this issue as well. They said it’s a caching issue from Ezoic’s end (I recently added Ezoic to my site a couple weeks ago and have been dealing with caching issues since).

    After deactivating YARPP and clearing the cache in Ezoic, the issue was resolved. However, I would still like to use this plugin. Is it not compatible with Ezoic?

    Plugin Author Michael Nelson

    (@mnelson4)

    Hi @sp691, I don’t think that error actually had anything to do with Ezoic, as YARPP’s cache is a database cache that’s probably totally separate from Ezoic’s form of caching (but I’m not very familiar with Ezoic and how it might differ from other caching plugins).

    Here’s a version of YARPP that might fix the warning (it’s a bit hard to say as I don’t know why you’d be getting this warning in the first place). Here’s how you can try it:

    1. Download the new version from here: https://drive.google.com/file/d/18TuS42NanOXu2OAE6r_wCRYQsvUVUQMv/view?usp=sharing
    2. Go to your WordPress dashboard, click plugins, then “add new”, then “upload” and select the zip file you just downloaded
    3. Deactivate the previous version of YARPP
    4. Activate the new version of YARPP

    If you’re able to test it, please let me know how it goes. If you can’t, no worries and we’ll do our best regardless.

    Plugin Author yarpp

    (@jeffparker)

    Hi @sp691 if you’re able to test, do let us know! If we can get verification that the test build fixes the warning you’re seeing, we can have the fix included in our next release — which is slated for next week! Thanks so much.

    Plugin Author yarpp

    (@jeffparker)

    @sp691 We have released a new version of YARPP today (v5.16.1) that attempts to resolve the issue you reported. Can you please confirm whether the release fixes the issue for you? Thanks so much!

    Thread Starter sp691

    (@sp691)

    Hello, thanks for letting me know about this update! Unfortunately, I am still seeing the warning message at the top of my pages.

    Plugin Author yarpp

    (@jeffparker)

    @sp691 have you cleared any caches (ex. caching plugins) that you may have?

    Thread Starter sp691

    (@sp691)

    Yes, I updated the plugin and re-activated it. Then cleared the cache in Ezoic. I actually did not see the Recent Posts listed at the bottom of my posts where it should be. However, I did still see the warning message at the top of my pages.

    I just tried it again and experienced the same thing.

    Hi @jeffparker

    I’ve also faced this issue even in the latest version but I’ve fix for this:

    $tt_ids = [];
    foreach( $terms as $term ) {
    	$tt_ids[] = $term->term_taxonomy_id;
    }
    Plugin Author yarpp

    (@jeffparker)

    @nikhilchaudhary Thanks so much!

    Would you be able to verify whether the following works for you?

    
    private function tax_criteria($reference_ID, $taxonomy) {
       $terms = get_the_terms($reference_ID, $taxonomy);
       // if there are no terms of that tax
       if (false === $terms) return '(1 = 0)';
       
       $tt_ids = [];
       $tt_ids = array_unique ( wp_list_pluck($terms, 'term_taxonomy_id') );
       
       return "count(distinct if( terms.term_taxonomy_id in (".join(',',$tt_ids)."), terms.term_taxonomy_id, null ))";
    
     }
    

    Unfortunately it generates a fatal error but we can resolve with this:

    $tt_ids = ( empty( $terms ) || is_wp_error( $terms ) ) ? [] : array_unique( wp_list_pluck( $terms, 'term_taxonomy_id' ) );

    Plugin Author yarpp

    (@jeffparker)

    @nikhilchaudhary can you please confirm whether the following looks good to you? Open to suggestions as well. We’re unable to replicate the issue; thank you so much for your help with this.

    private function tax_criteria ( $reference_ID, $taxonomy ) {
      $terms = get_the_terms( $reference_ID, $taxonomy );
      // If there are no terms or WP error
      if ( is_wp_error( $terms ) || false === $terms ) {
        return '(1 = 0)';
       }
      $term_object_to_array = wp_list_pluck( $terms, 'term_taxonomy_id' );
       // If empty
      if ( empty( $term_object_to_array ) ) {
        return '(1 = 0)';
      }
      $tt_ids = join( ',', $term_object_to_array );
        return "count(distinct if( terms.term_taxonomy_id in (" . $tt_ids . "), terms.term_taxonomy_id, null ))";
    }
    Plugin Author yarpp

    (@jeffparker)

    @nikhilchaudhary ping 🙂 Would you be able to test the code snippet above? Thanks so much in advance.

    @jeffparker As far as I can see this should be working absolutely fine.

    Plugin Author yarpp

    (@jeffparker)

    @nikhilchaudhary thank you for confirming!

    Plugin Author yarpp

    (@jeffparker)

    Fix has been released in v5.18.1! 🎉

Viewing 15 replies - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.