• Resolved kac1per

    (@kac1per)


    Hi,

    I really like this plugin and have been using it on my site for a while. However recently I stumbled across an issue when I tried to implement algolia search integration on the site (using official php library provided by Algolia) – for some reason it conflicts with the plugin.

    Specifically – algolia search integration requires initialization on save_post hook, so it can index post when created or updated. It looks like this:

    add_action('save_post', function ($id, WP_Post $post, $update) {
        global $algolia;
        $index = $algolia->initIndex($indexName);
    

    The initIndex method for some reason triggers following error, when YARPP is enabled

    "Trying to get property 'post_type' of non-object"
    stack:
    0: "YARPP_Cache->sql()"
    1: "YARPP_Cache_Tables->update()"
    2: "YARPP_Cache->enforce()"
    3: "YARPP->display_related()"
    4: "YARPP_Admin->ajax_display()"
    5: "do_action('wp_ajax_yarpp_display')"

    I have no idea why this happens or how to get around it. I would appreciate any help.

    • This topic was modified 4 years, 3 months ago by kac1per.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Michael Nelson

    (@mnelson4)

    Huh I’m not very familiar with Algolia, but it sounds YARPP is having that error because it expects there to be a Post but it’s something else instead… I doubt I’ll be able to reproduce this problem myself, but I can try to make a fix. Would you be willing to help test it on your site?

    Thread Starter kac1per

    (@kac1per)

    Of course, I’ll do it gladly

    Plugin Support Michael Nelson

    (@mnelson4)

    Great. Well I think I found the issue. Here’s how to test:

    1. Download the new version from here: https://drive.google.com/file/d/1vBYfrta13Gx9F4pf4PPpHOVwaUt2hYdu/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
    5. When you save a post, that error should no longer come up.

    Thanks @kac1per !

    Thread Starter kac1per

    (@kac1per)

    I tested new version and the error no longer comes up. Everything works correctly. Thank you!

    Plugin Support Michael Nelson

    (@mnelson4)

    Great thanks for confirming that. We’ll try to get this merged into the next release of YARPP.

    Plugin Support Michael Nelson

    (@mnelson4)

    Hi @kac1per, YARPP 5.10.2 was just released and contains this fix. Let me know if you see the problem again.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Plugin causes issues with algolia search integration’ is closed to new replies.