Support » Plugin: Relevanssi - A Better Search » White backend error in: …ajax_wrapper()

  • Resolved bonttimo


    I get a fatal error to the backend if I update Relevanssi higher than 4.0.9

    debug.log show error:
    PHP Fatal error: Cannot redeclare relevanssi_truncate_index_ajax_wrapper() (previously declared in /Applications/MAMP/htdocs/dev.onequartmagazine/wp-content/plugins/relevanssi/lib/admin-ajax.php:23) in /Applications/MAMP/htdocs/dev.onequartmagazine/wp-content/plugins/relevanssi/lib/admin-ajax.php on line 26

    If I comment all the code in admin-ajax.php the backend starts working. How can i fix this issue? what can cause this fatal error?

    • This topic was modified 8 months, 2 weeks ago by  bonttimo.

    The page I need help with: [log in to see the link]

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


    I would recommend reinstalling Relevanssi, looks like your files are somehow corrupt. That function should only be declared once in the file. Try copying the files by hand, maybe that works better.

    Hi(Moi) Mikko,

    I tried that but the same fatal error remained. I tried activating a WordPress default theme(twenty seventeen) and the site started working. I started to look into my theme file and found the cause of the error. Somehow that action brakes Relevanssi. If I change admin_menu to plugins_loaded, for example, Relevanssi loads correctly but the acction does not work anymore.

    The code that causes a fatal error:

    function set_admin_menu_separator() {
        do_action( 'admin_init', 79 );
        do_action( 'admin_init', 81 );
    add_action( 'admin_menu', 'set_admin_menu_separator' );
    Plugin Author Mikko Saari


    Ah, I see. Relevanssi is doing require where it should do require_once. That original error message is just really misleading.

    That code that causes the error doesn’t make any sense, though, and is likely to break other plugins as well. Why should admin_init action hook be run twice? Isn’t one time enough? I’m pretty sure Relevanssi isn’t the only plugin that expects it only to run once.

    Does the code work if you remove one do_action() there, so there’s just one?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘White backend error in: …ajax_wrapper()’ is closed to new replies.