• Resolved professor99

    (@professor99)


    Relevanssi includes an option to expand shortcodes of other plugins in posts when searching. If this is enabled I have found a bug in version 3.1.3 and version 3.1.4 of Relevanssi (that may exist in earlier versions) that may result in the server timing out when such a shortcode results in a post being added, updated, or deleted. In such a case an infinite loop will occur which will result in hundreds of copies of the original post being added to the database.

    The plugin I encountered this problem with is WP User Frontend (more about this problem and how I found this bug here).

    On investigating I found that a bug fix was already somewhat implemented in Relevanssi via the wp_insert_post action hook in init.php which calls the relevanssi_insert_edit() function but the cause of the old bug hadn’t been disabled.

    The fix for this bug is to comment out this line as follows in the Relevanssi file init.php

    //add_action(‘save_post’, ‘relevanssi_edit’, 99, 1);

    Cheers
    The Professor

    http://wordpress.org/extend/plugins/relevanssi/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Commenting out that line disables indexing new posts, so it’s not a very good solution for general use. But good to hear it helps with the problem with WP User Frontend.

    What is the shortcode that is causing the problem? Relevanssi has a list of shortcodes that don’t play nice with it, and those shortcodes are disabled during indexing. I can add this shortcode to the list.

    Thread Starter professor99

    (@professor99)

    Hi Mikko,

    Seems you missed what I was trying to say here

    Commenting out this line doesn’t stop your indexing.

    //add_action(‘save_post’, ‘relevanssi_edit’, 99, 1);

    Reason being is that the following line a few lines down from the one above already does the required indexing (with fix included)

    add_action(‘wp_insert_post’, ‘relevanssi_insert_edit’, 99, 1 );

    To me it seems this line was added as a fix to this problem but for some reason the original line wasn’t removed.

    Note that the action wp_insert_post always directly follows the action save_post in the two places it occurs (both in \wp-includes\post.php)
    wp_insert_post() & wp_publish_post().

    So without this fix you are effectively indexing twice and introducing a bug as well.

    Without this fix we get an infinite loop as stated in my given link as the expansion of the shortcode results in a recursive call.

    Plugin Author Mikko Saari

    (@msaari)

    No, the line was added to cover some cases the save_post action didn’t cover. I was not aware it is essentially a duplicate. However, since that’s the case, I’ll remove the save_post hook right away.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Bug with other Plugin Shortcodes’ is closed to new replies.