• Notice: register_rest_route was called incorrectly. The REST API route definition for nv/v1/posts/page/(?P\d+) 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/b8w1h184x61u/public_html/wp-includes/functions.php on line 5225

    Question: what causes this error? Is It due to latest WP update? Or something else?

    plugins used: using elementor pro + yoast + woocommerce plugins

    site: [ redundant link removed ]

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hallo ??

    The REST API is a way that your site makes information available to others via JSON (a machine-readable format).
    There are various default endpoints for the API.
    The API can also be extended.

    That error message means that one of the REST API endpoints your site uses, isn’t doing a permissions check.
    This isn’t necessarily a security issue, but you should check if the information displayed at the endpoint is supposed to be public.

    Hope this helps.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    The error is coming from a plugin or theme which needs to be updated. Look through your plugins or themes for something that might be called “nv”.

    In the meantime, this is a Notice only, so ask your host how to properly disable the “display_errors” setting in your PHP install.

    Thread Starter jasonsahli

    (@jasonsahli)

    My Friends: Thanks for the kind and helpful words. My nv theme (neve) is already running the running the latest version so still not sure how to correct this other than to notify the theme provider of the issue and see if they can fix it.

    Please notify the theme provider ??
    You can also refer them to the REST API channel on Slack, if they are unsure.
    This error message was added specifically to help make sites more private (and in some cases, a lot safer).
    Again, this does not necessarily mean that there is a problem, as the information may need to be public, but it is something that the developer should check.
    If it is intended to be public, they should add __return_true to the function – that will remove the warning message.

    Thread Starter jasonsahli

    (@jasonsahli)

    I will follow this helpful advice and thank u for being good wp stewards for help with this issue.

    • This reply was modified 4 years, 3 months ago by jasonsahli.

    @jasonsahli The Neve theme has a class called Pagination. Inside that class, they have a method called register_endpoints. Inside the Pagination->register_endpoints() method they are calling the register_rest_route function, and in the arguments they pass to it they don’t include a permission_callback as the error you’re getting mentions.
    Judging from their code, the callback they are performing doesn’t get any private data so they can simply add this line in their arguments to make it work properly:
    'permission_callback' => '__return_true',
    So the end code on that method would look like this:

    public function register_endpoints() {
    	register_rest_route(
    		'nv/v1/posts',
    		'/page/(?P<page_number>\d+)/',
    		array(
    			'methods'             => \WP_REST_Server::CREATABLE,
    			'callback'            => array( $this, 'get_posts' ),
    			'permission_callback' => '__return_true'
    		)
    	);
    }

    You can contact your theme theme-author with that information so they can fix it. ??

    thank you very much you helped me a lot

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘REST API ERRORS’ is closed to new replies.