• Resolved mupic

    (@waldub)


    Fatal error: Uncaught TypeError: Argument 1 passed to WP_Rest_Cache_Plugin\Includes\API\Endpoint_Api::add_wordpress_endpoints() must be of the type array, string given, called in …\wp-includes\class-wp-hook.php on line 286
    and defined in …\wp-content\plugins\wp-rest-cache\includes\api\class-endpoint-api.php:268
    Stack trace: #0 …\wp-includes\class-wp-hook.php(286): WP_Rest_Cache_Plugin\Includes\API\Endpoint_Api->add_wordpress_endpoints(”)
    #1 …\wp-includes\plugin.php(208): WP_Hook->apply_filters(”, Array)
    #2 …\wp-content\plugins\wp-rest-cache\includes\api\class-endpoint-api.php(249): apply_filters(‘wp_rest_cache/a…’, ”)
    #3 …\wp-includes\class-wp-hook.php(286): WP_Rest_Cache_Plugin\Includes\API\Endpoint_Api->save_options(”)
    #4 …\wp-content\plugins\wp-rest-cache\includes\api\class-endpoint-api.php on line 268

    I tried add endpoint and this happened.

    function wprc_add_acf_nav_menu_items_endpoint( $allowed_endpoints ) {
    if ( ! isset( $allowed_endpoints[ ‘extended/v1’ ] ) || ! in_array( ‘nav_menu_item’, $allowed_endpoints[ ‘extended/v1’ ] ) ) {
    $allowed_endpoints[ ‘extended/v1’ ][] = ‘nav_menu_item’;
    }
    return $allowed_endpoints;
    }
    add_filter( ‘wp_rest_cache/allowed_endpoints’, ‘ExtendRestApi\wprc_add_acf_nav_menu_items_endpoint’, 10, 1);

    Even if I delete this code the error does not go away

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Acato

    (@acato)

    Hi @waldub

    Thank you for using our plugin!

    We just released a new version which should solve at least part of your problem (the fact the error doesn’t go away after you deleted your code).

    I am however not sure why you ever got this error, at some point your filter function must have returned a string in stead of the array $allowed_endpoints. Could you please download the latest version of our plugin and retry?

    Thread Starter mupic

    (@waldub)

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fatal error: Uncaught TypeError: Argument 1 passed to’ is closed to new replies.