Rest API issues with PHP 8.0 and 8.1
-
Hi Evan, l need your assistance with rest api and PHP 8.0.
If i set the fields l want in the rest api l get the follwoing error:
Warning: Undefined array key "custom_key" in /usr/www/users/thefozvzmm/wp-content/plugins/wp-rest-api-controller/wp-rest-api-controller.php on line 320 Warning: Undefined array key "custom_key" in /usr/www/users/thefozvzmm/wp-content/plugins/wp-rest-api-controller/wp-rest-api-controller.php on line 320 Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/www/users/thefozvzmm/wp-content/plugins/wp-rest-api-controller/wp-rest-api-controller.php:320 Stack trace: #0 /usr/www/users/thefozvzmm/wp-content/plugins/wp-rest-api-controller/wp-rest-api-controller.php(255): WP_REST_API_Controller->get_original_meta_key_name('at_biz_dir', '_price', false) #1 /usr/www/users/thefozvzmm/wp-includes/rest-api/endpoints/class-wp-rest-controller.php(433): WP_REST_API_Controller->custom_meta_data_callback(Array, '_price', Object(WP_REST_Request), 'at_biz_dir') #2 /usr/www/users/thefozvzmm/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(1923): WP_REST_Controller->add_additional_fields_to_object(Array, Object(WP_REST_Request)) #3 /usr/www/users/thefozvzmm/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(377): WP_REST_Posts_Controller->prepare_item_for_response(Object(WP_Post), Object(WP_REST_Request)) #4 /usr/www/users/thefozvzmm/wp-includes/rest-api/class-wp-rest-server.php(1143): WP_REST_Posts_Controller->get_items(Object(WP_REST_Request)) #5 /usr/www/users/thefozvzmm/wp-includes/rest-api/class-wp-rest-server.php(990): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wp/v2/at_biz_d...', Array, NULL) #6 /usr/www/users/thefozvzmm/wp-includes/rest-api/class-wp-rest-server.php(414): WP_REST_Server->dispatch(Object(WP_REST_Request)) #7 /usr/www/users/thefozvzmm/wp-includes/rest-api.php(394): WP_REST_Server->serve_request('/wp/v2/at_biz_d...') #8 /usr/www/users/thefozvzmm/wp-includes/class-wp-hook.php(307): rest_api_loaded(Object(WP)) #9 /usr/www/users/thefozvzmm/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array) #10 /usr/www/users/thefozvzmm/wp-includes/plugin.php(524): WP_Hook->do_action(Array) #11 /usr/www/users/thefozvzmm/wp-includes/class-wp.php(398): do_action_ref_array('parse_request', Array) #12 /usr/www/users/thefozvzmm/wp-includes/class-wp.php(770): WP->parse_request('') #13 /usr/www/users/thefozvzmm/wp-includes/functions.php(1330): WP->main('') #14 /usr/www/users/thefozvzmm/wp-blog-header.php(16): wp() #15 /usr/www/users/thefozvzmm/index.php(17): require('/usr/www/users/...') #16 {main} thrown in /usr/www/users/thefozvzmm/wp-content/plugins/wp-rest-api-controller/wp-rest-api-controller.php on line 320
if i just enable the plugin and all fields not selected the API works.
I need the following fields for my app to work in php 8.0 to be able to sent notifications based on location and distance from coordinates.Fields needed in rest api: _manual_lat and _manual_lng if l enable them the rest api won’t work is there a way to get these values like meta_fields in PHP l can use
The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Rest API issues with PHP 8.0 and 8.1’ is closed to new replies.