• Resolved Tim

    (@timwakeling-1)


    Hi

    Love your plugin!

    I’ve just found a small bug which you might want to correct. When a function on the front end tries to use the WP function to insert a post, Relevanssi tries to index it – but in the process it calls the is_plugin_active() function of WordPress (on line 733 in relevanssi/lib/indexing.php).

    Because is_plugin_active() can only be called within the admin area, this results in a PHP fatal error.

    The Codex suggests adding this when not in the admin, which will make the is_plugin_active() succeed:
    <?php include_once( ABSPATH . ‘wp-admin/includes/plugin.php’ ); ?>

    Hope this helps! ??

    Tim

    https://www.ads-software.com/plugins/relevanssi/

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

    (@msaari)

    Thanks, I’ll make sure that is fixed in the next version.

    Thread Starter Tim

    (@timwakeling-1)

    Thanks Mikko! ??

    Tim

    Landon

    (@landonbotis)

    I just found this in my error log today while trying to find an issue in Gravity Forms. After disabling this plugin my issue with Gravity Forms was fixed. Very strange. Any idea when a fix will be out or what the fix is so I can apply it before the update?

    Thanks.

    Thanks @timwakeling-1. You helped me get to the bottom of this.

    If anyone is looking for a temporary workaround, one option is to add include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); just above if (! is_plugin_active('advanced-custom-fields/acf.php')) return ; in lib/indexing.php line 733 as a temporary workaround until a patch is offered by @msaari.

    Also, @msaari, I’m curious as to whether or not ACF Pro would render this code futile? The path to ACF Pro is advanced-custom-fields-pro/acf.php. Are ACF Pro users getting the benefit of the indexing?

    Thanks for a great plugin!!

    • This reply was modified 8 years, 1 month ago by jpollock.
    Plugin Author Mikko Saari

    (@msaari)

    This is indeed coming to the next version. When’s that, well, I’ve learnt not to make any promises. Feel free to fix the code for yourself, it’s a one line fix as mentioned above.

    Good point about ACF Pro –?this code came from a contributor, who I assume is using non-Pro ACF. As it is, it doesn’t apply to ACF Pro. Changing

    if (! is_plugin_active('advanced-custom-fields/acf.php')) return;`

    to

    if (! is_plugin_active('advanced-custom-fields/acf.php') && ! is_plugin_active('advanced-custom-fields-pro/acf.php')) return;

    should fix that.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Bug when posts are inserted from front end with Relevanssi active’ is closed to new replies.