10up / ElasticPress

A fast and flexible search and query engine for WordPress.
https://elasticpress.io
GNU General Public License v2.0
1.25k stars 312 forks source link

Uncaught Error: Class 'WP_Widget_Block' not found in elasticpress/includes/classes/Feature/Facets/Types/Meta/FacetType.php on line 248 #3401

Closed TorlockC closed 1 year ago

TorlockC commented 1 year ago

Hello and thanks for the plugin.

I've set up a self-hosted Elasticsearch server, connected successfully and have begun an initial sync. However, when testing the site search I get the following fatal error every time:

Fatal error: Uncaught Error: Class 'WP_Widget_Block' not found
in /var/app/current/wp-content/plugins/elasticpress/includes/classes/Feature/Facets/Types/Meta/FacetType.php on line 248

Call stack:

    ElasticPress\F\F\T\M\FacetType::get_facets_meta_fields()
    wp-content/plugins/elasticpress/includes/classes/Feature/Facets/Types/Meta/FacetType.php:106
    ElasticPress\F\F\T\M\FacetType::set_wp_query_aggs()
    wp-includes/class-wp-hook.php:287
    WP_Hook::apply_filters()
    wp-includes/plugin.php:212
    apply_filters()
    wp-content/plugins/elasticpress/includes/classes/Feature/Facets/Facets.php:318
    ElasticPress\F\F\Facets::facet_query()
    wp-includes/class-wp-hook.php:287
    WP_Hook::apply_filters()
    wp-includes/class-wp-hook.php:311
    WP_Hook::do_action()
    wp-includes/plugin.php:551
    do_action_ref_array()
    wp-includes/class-wp-query.php:1779
    WP_Query::get_posts()
    wp-includes/class-wp-query.php:3448
    WP_Query::query()
    wp-includes/class-wp.php:624
    WP::query_posts()
    wp-includes/class-wp.php:747
    WP::main()
    wp-includes/functions.php:1291
    wp()
    wp-blog-header.php:16
    require()
    index.php:17

Does anybody know what this could be related to or how I would go about starting to diagnose the issue?

Thanks in advance for any assistance.

felipeelia commented 1 year ago

@TorlockC can you please share with us the full content of the ElasticPress Status Report? Thanks.

TorlockC commented 1 year ago

Of course, copied below:

Failed Queries

WordPress

WordPress Environment

wp_version: 5.6 home_url: http://my-domain.com site_url: http://my-domain.com is_multisite: false theme: astra-child (1.0.0) parent_theme: Astra (4.0.1) plugins: Advanced Shipment Tracking for WooCommerce (3.5.2), Ajax Search Pro (4.22), Clever Mega Menu for Elementor (1.1.2), ElasticPress (4.5.0), Elementor (3.5.6), Elementor Pro (3.6.3), External Images (2.52), HubSpot All-In-One Marketing - Forms, Popups, Live Chat (10.0.21), MWB HubSpot for WooCommerce (1.4.4), Paid On Results - WooCommerce (3.0.3), PDF Invoices & Packing Slips for WooCommerce (3.4.0), PDF Invoices & Packing Slips for WooCommerce - Premium Templates (2.19.6), Premmerce Product Filter for WooCommerce (3.7), Purchase Orders for WooCommerce (1.8.2), Query Monitor (3.11.2), Rvvup for WooCommerce (1.20230126085953.main.4645e7e2), S3 Uploads (2.1.0-RC2), Scalability Pro (4.68), Shipping Method Description for WooCommerce (1.2.6), Trustpilot-reviews (2.5.914), W3 Total Cache (2.1.9), WooCommerce (5.8.0), WooCommerce EU VAT Assistant (2.0.37.221203), WooCommerce PayPal Payments (2.0.2), WooCommerce PDF Invoices & Packing Slips Professional (2.9.2), WooCommerce Split Orders (1.5.1), Wordfence Security (7.9.0), WP All Export - WooCommerce Export Add-On Pro (1.0.6), WP All Export Pro (1.8.3), WP All Import - WooCommerce Import Add-On Pro (3.3.4), WP All Import Pro (4.7.8) and WP Offload SES Lite (1.6.0) revisions: all

Server Environment

php_version: 7.4.28 memory_limit: 40M timeout: 60

Indexable Content

https://my-domain.com

post_count: 14 page_count: 31 e-landing-page_count: 32 elementor_library_count: 69 product_count: 100,297 post-type-template_count: 0 cmm4e_menu_count: 18 post_meta_keys: 1 page_meta_keys: 15 e-landing-page_meta_keys: 7 elementor_library_meta_keys: 7 product_meta_keys: 44 post-type-template_meta_keys: 0 cmm4e_menu_meta_keys: 8 total-all-post-types: 51 distinct-meta-keys: _thumbnail_id, layout, sidebar, footer, header_title_bar, header_transparency, external_image_url, eigallery, site-post-title, site-sidebar-layout, site-content-layout, ast-breadcrumbs-content, theme-transparent-header-meta, ast-title-bar-display, ast-featured-img, ei_converted, _backorders, _downloadable, _manage_stock, _price, _product_attributes, _product_image_gallery, _product_version, _regular_price, _sku, _sold_individually, _stock, _stock_status, _tax_class, _tax_status, _virtual, _wc_average_rating, cost_price, hubwoo_ecomm_pro_id, supplierid, total_sales, onsale, _crosssell_ids, _sale_price, _weight, wpmm_postgrid_views, eili, ei, _height, _length, _width, _upsell_ids, _visibility, hubwoo_ecomm_invalid_pro, cmm4e_menu_id and cmm4e_menu_item_id

ElasticPress

Settings

host: http://ec2-elasticsearchurl.eu-west-2.compute.amazonaws.com:9200 index_prefix: language: en_GB per_page: 10 network_active: false

Timeouts

request_timeout: 5 index_document_timeout: 15 bulk_request_timeout: 30

Elasticsearch Indices

transparentukcom-post-1

health: yellow status: open index: transparentukcom-post-1 uuid: eNYfP0aDQa2eI2nMgtpvEg pri: 5 rep: 1 docs.count: 15757 docs.deleted: 28 store.size: 89.9mb pri.store.size: 89.9mb total_fields_limit: 5000

Last Sync

2023/03/21 6:24:13 pm (In Progress)

method: WP Dashboard is_full_sync: Yes end_date_time: 2023/03/21 6:26:57 pm total_time: 0 hours, 2 minutes, 45 seconds total: 100457 synced: 0 skipped: 0 failed: 100457 errors: array ( 0 => 'Maximum execution time of 60 seconds exceeded', )

Feature Settings

Autosuggest

active: true autosuggest_selector: endpoint_url: force_inactive: false trigger_ga_event: 0

Custom Search Results

active: true force_inactive: false

Facets

active: true force_inactive: false match_type: all

Post Search

active: true decaying_enabled: 1 force_inactive: false highlight_enabled: 0 highlight_excerpt: 0 highlight_tag: mark synonyms_editor_mode: simple

Related Posts

active: true force_inactive: false

WooCommerce

active: true force_inactive: false orders: 0

felipeelia commented 1 year ago

@TorlockC, it seems the WP_Widget_Block class was made available only in WordPress 5.8, that would explain why you are seeing that error. We'll have that fixed in a future release but in the meantime, would it be possible for you to upgrade to a newer version of WordPress? Thanks!

TorlockC commented 1 year ago

Perfect thanks for the clarification, will take a look into upgrading as a priority then.

On Wed, 22 Mar 2023, 19:54 Felipe Elia, @.***> wrote:

@TorlockC https://github.com/TorlockC, it seems the WP_Widget_Block class was made available only in WordPress 5.8, that would explain why you are seeing that error. We'll have that fixed in a future release but in the meantime, would it be possible for you to upgrade to a newer version of WordPress? Thanks!

— Reply to this email directly, view it on GitHub https://github.com/10up/ElasticPress/issues/3401#issuecomment-1480177078, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMJB5ZYJWZUOSTNG3B2SBBLW5NKIHANCNFSM6AAAAAAWEF4JTM . You are receiving this because you were mentioned.Message ID: @.***>