• Resolved mihailmc

    (@mihailungu)


    Filter Everything is crashing my admin. There is another topic with the same issue, but i can’t post in there, even if i have the same problem (which in my opinion is so stupid, it makes no sense to have 1000 posts for the same exact issue…)

    But here it goes:


    Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, string given in /home/muzehubc/public_html/wp-content/plugins/filter-everything/src/Admin/AdminHooks.php:144 Stack trace: #0 /home/muzehubc/public_html/wp-content/plugins/filter-everything/src/Admin/AdminHooks.php(144): in_array() #1 /home/muzehubc/public_html/wp-includes/class-wp-hook.php(324): FilterEverything\Filter\AdminHooks->checkForbiddenPrefixes() #2 /home/muzehubc/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #3 /home/muzehubc/public_html/wp-includes/plugin.php(517): WP_Hook->do_action() #4 /home/muzehubc/public_html/wp-admin/admin-header.php(303): do_action() #5 /home/muzehubc/public_html/wp-admin/plugins.php(637): require_once(‘/home/muzehubc/…’) #6 {main} thrown in /home/muzehubc/public_html/wp-content/plugins/filter-everything/src/Admin/AdminHooks.php on line 144

    I am using Astra Theme, changing it doesn’t solve the issue. Disabling all other plugins also won;t solve the issue.

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter mihailmc

    (@mihailungu)

    Fixed by
    – editing AdminHooks.php – replaced from line 137 to 179 with the below code.
    – got back the admin dashboard
    – deleted all filters
    – deleted the plugin Filter Everything
    – reinstalled the plugin
    – recreated filters

    public function checkForbiddenPrefixes()
    {
    $forbiddenPrefixes = flrt_get_forbidden_prefixes();
    $savedPrefixes = get_option( 'wpc_filter_permalinks', [] );

    // Ensure $savedPrefixes is an array
    if (!is_array($savedPrefixes)) {
    $savedPrefixes = maybe_unserialize($savedPrefixes);
    }
    if (!is_array($savedPrefixes)) {
    $savedPrefixes = []; // If still not an array, default to an empty array
    }

    $warningPrefixes = [];

    foreach( $forbiddenPrefixes as $prefix ) {
    if( in_array( $prefix, $savedPrefixes, true ) ) {
    $warningPrefixes[] = $prefix;
    }
    }

    $permalinkOptionsUrl = admin_url( 'edit.php?post_type=filter-set&page=filters-settings&tab=prefixes' );
    $permalinksTab = new PermalinksTab();
    $permalinksTabLabel = strtolower( $permalinksTab->getLabel() );

    if( ! empty( $warningPrefixes ) ){
    $message = wp_kses(
    sprintf(
    _n(
    'Error: <strong>%s</strong> filter prefix is not allowed and must be changed on the Filter %s settings <a href="%s" target="_blank">page</a>. Otherwise this site will not work properly.',
    'Error: following filter prefixes <strong>%s</strong> are not allowed and must be changed on the Filter %s settings <a href="%s" target="_blank">page</a>. Otherwise this site will not work properly.',
    count($warningPrefixes),
    'filter-everything'
    ),
    implode( ', ', $warningPrefixes ), $permalinksTabLabel, $permalinkOptionsUrl
    ),
    array(
    'strong' => array(),
    'a' => array('href' => true, 'target' => true)
    )
    );

    ?>
    <div class="notice wpc-error is-dismissible">
    <p><?php echo $message; ?></p>
    </div>
    <?php
    }
    }
    Plugin Support fesupportteam

    (@fesupportteam)

    Hi @mihailungu

    This issue has been forwarded to our development team from the first request, and they’ve assured us it will be resolved in the next updates.

    We apologize for any inconvenience this may have caused.

    Best Regards – Victor

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

The topic ‘Admin Dashboard Crash’ is closed to new replies.