• Resolved Brian Henry

    (@brianhenryie)


    From our logs:

    {
    	"function": "wp_send_json",
    	"message": "Return a WP_REST_Response or WP_Error object from your callback when using the REST API.",
    	"version": "5.5.0",
    	"exception": "
            #0 \/path\/to\/public_html\/wp-includes\/functions.php(4107): _doing_it_wrong('wp_send_json', 'Return a WP_RES...', '5.5.0')
            #1 \/path\/to\/public_html\/wp-includes\/functions.php(4151): wp_send_json(Array, NULL, 0)
            #2 \/path\/to\/public_html\/wp-content\/plugins\/sg-cachepress\/core\/Rest\/Rest_Helper_Options.php(142): wp_send_json_success(Array)
            #3 \/path\/to\/public_html\/wp-includes\/rest-api\/class-wp-rest-server.php(1139): SiteGround_Optimizer\\Rest\\Rest_Helper_Options->fetch_options(Object(WP_REST_Request))
            #4 \/path\/to\/public_html\/wp-includes\/rest-api\/class-wp-rest-server.php(985): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '\/siteground-opt...', Array, NULL)
            #5 \/path\/to\/public_html\/wp-includes\/rest-api\/class-wp-rest-server.php(412): WP_REST_Server->dispatch(Object(WP_REST_Request))
            #6 \/path\/to\/public_html\/wp-includes\/rest-api.php(354): WP_REST_Server->serve_request('\/siteground-opt...')
            #7 \/path\/to\/public_html\/wp-includes\/class-wp-hook.php(292): rest_api_loaded(Object(WP))
            #8 \/path\/to\/public_html\/wp-includes\/class-wp-hook.php(316): WP_Hook->apply_filters(NULL, Array)
            #9 \/path\/to\/public_html\/wp-includes\/plugin.php(551): WP_Hook->do_action(Array)
            #10 \/path\/to\/public_html\/wp-includes\/class-wp.php(388): do_action_ref_array('parse_request', Array)
            #11 \/path\/to\/public_html\/wp-includes\/class-wp.php(750): WP->parse_request('')
            #12 \/path\/to\/public_html\/wp-includes\/functions.php(1291): WP->main('')
            #13 \/path\/to\/public_html\/wp-blog-header.php(16): wp()
            #14 \/path\/to\/public_html\/index.php(17): require('\/home\/customer\/...')
            #15 {main}
        "
    }

    Twice in quick succession, today, no occurrence in previous 12 days.

    PHP 7.4.2. WordPress 5.7.2. SG Optimizer 5.8.0.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Stanimir Stoyanov

    (@sstoqnov)

    SiteGround Representative

    Hey @brianhenryie

    I was unable to reproduce the issue. Would it be possible to provide your site URL, so I can check what is causing the issue?

    Regards,
    Stanimir

    Thread Starter Brian Henry

    (@brianhenryie)

    I took a look at functions.php(4107) – another plugin must be setting REST_REQUEST to true.

    From grep, it looks to be woocommerce-zapier or (less likely) WooCommerce itself.

    Plugin Author Stanimir Stoyanov

    (@sstoqnov)

    SiteGround Representative

    Hey @brianhenryie

    We will check how we can avoid such notices by replacing our rest responses with WP_Rest_Response class.

    We will update the ticket once we do the replacement.

    Regards,
    Stanimir

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Return a WP_REST_Response or WP_Error object from your callback when using the R’ is closed to new replies.