• Resolved Maxime33

    (@maxime33)


    Hello,

    I just installed the plugin, it works fine on a search with the custom post type “post”, but it causes a fatal error as soon as I want to search on another post type (already registered for indexing in the Relevanssi settings and works with a simple WP_Query). Here is the error in the logs:

    PHP Fatal error: Uncaught Error: Call to a member function prepare_item_for_response() on null in /home/web/public_html/wp-content/plugins/rest-api-for-relevanssi/rest-api-for-relevanssi.php:206
    Stack trace:
    0 /home/web/public_html/wp-includes/rest-api/class-wp-rest-server.php(1171): rest_api_plugin_for_relevanssi->relevanssi_search_callback(Object(WP_REST_Request))
    1 /home/web/public_html/wp-includes/rest-api/class-wp-rest-server.php(1018): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/relevanssi/v1/…', Array, NULL)
    2 /home/web/public_html/wp-includes/rest-api/class-wp-rest-server.php(442): WP_REST_Server->dispatch(Object(WP_REST_Request))
    3 /home/web/public_html/wp-includes/rest-api.php(410): WP_REST_Server->serve_request('/relevanssi/v1/…')
    4 /home/web/public_html/wp-includes/class-wp-hook.php(308): rest_api_loaded(Object(WP))
    5 /home/web/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
    6 in /home/web/public_html/wp-content/plugins/rest-api-for-relevanssi/rest-api-for-relevanssi.php on line 206

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Sergiy Dzysyak

    (@dzysyak)

    Thank you for the report. I will try to reproduce the issue. As far as I understand that happened with latest versions WP & Relevanssi?

    Thread Starter Maxime33

    (@maxime33)

    Thank you for your quick answer!

    Yes, everything is in latest versions: WP 6.2 and Relevanssi 4.19.0. I use PHP 7.4.

    Plugin Author Sergiy Dzysyak

    (@dzysyak)

    Please, try to install the latest version of the plugin from the directory. The update should fix the issue. Let me know either this helped to solve your issue or not.

    Thank you.

    Thread Starter Maxime33

    (@maxime33)

    Hello,

    Thank you for your reply. Unfortunately, the problem is still there. A line in the log has been added though:

    [14-May-2023 19:19:36 UTC] PHP Notice: Undefined index: post in /home/web/public_html/wp-content/plugins/rest-api-for-relevanssi/rest-api-for-relevanssi.php on line 207

    [14-May-2023 19:19:36 UTC] PHP Fatal error: Uncaught Error: Call to a member function prepare_item_for_response() on null in /home/web/public_html/wp-content/plugins/rest-api-for-relevanssi/rest-api-for-relevanssi.php:207

    The search with a post type “post” works.

    Plugin Author Sergiy Dzysyak

    (@dzysyak)

    Are you “Advanced Custom Fields” plugin? or something like that?

    I have just updated the plugin to support Advanced Custom Fields & ACF to REST API.

    If you are using them, than plugin should work now. If you use something else, please let me know what exactly & I will update the plugin.

    Thread Starter Maxime33

    (@maxime33)

    Hello,

    Yes, it works now! Thank you very much ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Fatal error when searching custom post type’ is closed to new replies.