• Hi Support need assistance with the plugin error title above. I have disabled all plugins and the error only goes away when l downgrade to PHP 7.4 which is not going to be supported by my hosting provider.

    Plugin Version: Version 2.1.1

    I have upgraded my PHP to 8.1 and the WP REST API Controller for listing listings link above is the only one not working the other api links below works:

    Working
    https://www.legalconnect.co.za/wp-json/wp/v2/at_biz_dir-category
    https://www.legalconnect.co.za/wp-json/wp/v2/at_biz_dir-location

    Not Working
    https://www.legalconnect.co.za/wp-json/wp/v2/at_biz_dir

    Error Returned

    Warning: Undefined array key "custom_key" in /usr/www/users/legalqtrdn/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/legalqtrdn/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/legalqtrdn/wp-content/plugins/wp-rest-api-controller/wp-rest-api-controller.php:320
    Stack trace:
    #0 /usr/www/users/legalqtrdn/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', '_tagline', false)
    #1 /usr/www/users/legalqtrdn/wp-includes/rest-api/endpoints/class-wp-rest-controller.php(433): WP_REST_API_Controller->custom_meta_data_callback(Array, '_tagline', Object(WP_REST_Request), 'at_biz_dir')
    #2 /usr/www/users/legalqtrdn/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/legalqtrdn/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/legalqtrdn/wp-includes/rest-api/class-wp-rest-server.php(1143): WP_REST_Posts_Controller->get_items(Object(WP_REST_Request))
    #5 /usr/www/users/legalqtrdn/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/legalqtrdn/wp-includes/rest-api/class-wp-rest-server.php(414): WP_REST_Server->dispatch(Object(WP_REST_Request))
    #7 /usr/www/users/legalqtrdn/wp-includes/rest-api.php(394): WP_REST_Server->serve_request('/wp/v2/at_biz_d...')
    #8 /usr/www/users/legalqtrdn/wp-includes/class-wp-hook.php(307): rest_api_loaded(Object(WP))
    #9 /usr/www/users/legalqtrdn/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
    #10 /usr/www/users/legalqtrdn/wp-includes/plugin.php(524): WP_Hook->do_action(Array)
    #11 /usr/www/users/legalqtrdn/wp-includes/class-wp.php(398): do_action_ref_array('parse_request', Array)
    #12 /usr/www/users/legalqtrdn/wp-includes/class-wp.php(770): WP->parse_request('')
    #13 /usr/www/users/legalqtrdn/wp-includes/functions.php(1330): WP->main('')
    #14 /usr/www/users/legalqtrdn/wp-blog-header.php(16): wp()
    #15 /usr/www/users/legalqtrdn/index.php(17): require('/usr/www/users/...')
    #16 {main}
      thrown in /usr/www/users/legalqtrdn/wp-content/plugins/wp-rest-api-controller/wp-rest-api-controller.php on line 320

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Evan Herman

    (@eherman24)

    Hi @tigere

    Have you added a custom meta key value for any of the post meta values for that at_biz_dir post type?

    Can you try turning off all of the meta values from the settings page for at_biz_dir and see if that resolves the error. If it does, try and turning them back on one at a time, to check if it’s just one meta value or all of them.

    The ‘custom_key’ value should be set in the database when the settings page is saved, even if it’s an empty value it should still exist.

    I’ll do some testing to see if I can replicate this before you have a chance to test, but if you could test and provide some additional info. that would certainly help find the issue on my end (since we don’t have the same data on the settings page)

    Thanks,
    Evan

    Thread Starter tigere

    (@tigere)

    Thanks for the assist the listings are now displaying by switching off the meta values

    Thread Starter tigere

    (@tigere)

    I will try the meta values one by one and see if l gt any problems but switching them all off the listings does show

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Warning: Undefined array key “custom_key”’ is closed to new replies.