• Resolved dimal

    (@dimalifragis)


    Hello. WordPress 6.4.2 – PHP 8.1.x

    [07-Dec-2023 22:55:58 UTC] PHP Notice: Function register_rest_route was called incorrectly. The REST API route definition for weather-atlas/v1/widgets is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in /home/wp-includes/functions.php on line 6031

    Any ideas what this could be?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Weather Atlas

    (@weatheratlas)

    public function register_routes() {
    register_rest_route( ‘weather-atlas/v1’, ‘/widgets’, array(
    ‘methods’ => ‘GET’,
    ‘callback’ => array( $this, ‘get_weather_widgets’ ),
    ‘permission_callback’ => ‘__return_true’, // this line will be added in next v.
    ) );
    }

    The fix is 'permission_callback' => '__return_true'telling WordPress that the route is public and does not require any specific permissions to access.
    We’ll test it and add it soon.

    Thread Starter dimal

    (@dimalifragis)

    thanks, btw the widget is missing the C or F at the top (big) temperature number.

    Plugin Author Weather Atlas

    (@weatheratlas)

    1. Fix is implemented.
    2. C or F are “missing” by design
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP Notice: Function register_rest_route was called incorrectly’ is closed to new replies.