• Resolved bluedogranch

    (@bluedogranch)


    Hi,

    I get this fatal error in Version 4.27.0, but only when using the Relevanssi admin option “Use Relevanssi for admin searches” and only when searching Events in admin when using https://ww.wp.xz.cn/plugins/the-events-calendar/

    I do not get the fatal error when using “Use Relevanssi for admin searches” and searching WordPress posts, pages, etc., in admin.

    So I don’t know where to look for a fix 🙂

    Thanks!

    PHP Fatal error:  Uncaught TypeError: Cannot access offset of type string on string in /html/wp-content/plugins/rel evanssi/lib/search.php:1243
    Stack trace:
    #0 /html/wp-content/plugins/relevanssi/lib/search.php(1769): relevanssi_meta_query_from_query_vars(Object(WP_Query))
    #1 /html/wp-content/plugins/relevanssi/lib/search.php(949): relevanssi_compile_common_args(Object(WP_Query))
    #2 /html/wp-content/plugins/relevanssi/lib/search.php(612): relevanssi_compile_search_args(Object(WP_Query), 'land legacy')
    #3 /html/wp-content/plugins/relevanssi/lib/search.php(88): relevanssi_do_query(Object(WP_Query))
    #4 /html/wp-includes/class-wp-hook.php(341): relevanssi_query(NULL, Object(WP_Query))
    #5 /html/wp-includes/plugin.php(256): WP_Hook->apply_filters(NULL, Array)
    #6 /html/wp-includes/class-wp-query.php(3226): apply_filters_ref_array('posts_pre_query', Array)
    #7 /html/wp-includes/class-wp-query.php(3958): WP_Query->get_posts()
    #8 /html/wp-includes/class-wp.php(704): WP_Query->query(Array)
    #9 /html/wp-includes/class-wp.php(824): WP->query_posts()
    #10 /html/wp-includes/functions.php(1343): WP->main(Array)
    #11 /html/wp-admin/includes/post.php(1319): wp(Array)
    #12 /html/wp-admin/includes/class-wp-posts-list-table.php(165): wp_edit_posts_query()
    #13 /html/wp-admin/edit.php(235): WP_Posts_List_Table->prepare_items()
    #14 {main}
    thrown in /html/wp-content/plugins/relevanssi/lib/search.php on line 1243
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Mikko Saari

    (@msaari)

    I happen to have The Events Calendar. I tried replicating this problem, but can’t: the admin search works fine.

    This error comes from the way the meta queries are handled. Do you have any custom filtering code related to meta queries?

    Thread Starter bluedogranch

    (@bluedogranch)

    Thanks! I don’t know about any custom queries; where would I look? I am using Twig https://flyntwp.com/ for a theme.

    Plugin Author Mikko Saari

    (@msaari)

    If you don’t know, then you probably don’t have any. It’s something you probably should’ve added yourself to a code snippet or in the theme functions.php.

    However, without knowing what the meta query looks like, there’s little I can do to help. I don’t know how there would be a meta query in the first place.

    Thread Starter bluedogranch

    (@bluedogranch)

    Thanks! I know this is difficult. I found this; it might be related:

    /wp-content/plugins/the-events-calendar/src/Events/Custom_Tables/V1/WP_Query/Custom_Tables_Query.php


    /**
    * Replaces the
    WP_Meta_Query instance built in the WP_Query::get_posts method with an instance of
    * the WP_Meta_Query extension that will redirect some custom fields queries to the plugin custom tables.
    *
    * This method is expected to be hooked to the posts_search hook in the WP_Query::get_posts method.
    * The method will not change
    *
    * @since 6.0.0
    *
    * @param string $search The WHERE clause as produced by the WP_Query instance.
    * @param WP_Query $wp_query A reference to the WP_Query instance whose search WHERE clause is currently being
    * filtered.
    *
    * @return string The WHERE clause as produced by the WP_Query instance, untouched by the method.
    */
    public function replace_meta_query( $search, $wp_query ) {
    if ( $wp_query !== $this ) {
    // Only target the class own instance.
    return $search;
    }

    Plugin Author Mikko Saari

    (@msaari)

    Yes, looks like The Events Calendar does something with the meta query. But why it does it on your site but not on my site? The Events Calendar floods my error logs with deprecation notices when run with PHP 8.5, but doesn’t cause any fatal errors related to meta queries in the admin search.

    But if this is the only place where the problem happens, the solution is easy: disable Relevanssi in the admin search, and use the Relevanssi Admin Search to do the admin searching.

    Thread Starter bluedogranch

    (@bluedogranch)

    Thanks, I disabled Relevanssi in the admin search, but what do you mean by “use the Relevanssi Admin Search to do the admin searching”?

    https://postimg.cc/mP6wyRhZ

    Plugin Author Mikko Saari

    (@msaari)

    There’s a Relevanssi search in your admin menu at Dashboard > Admin search.

    Thread Starter bluedogranch

    (@bluedogranch)

    Ah, thanks!

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

You must be logged in to reply to this topic.