• On a request a post in the response, I have a header X-WP-DoingItWrong
    with a message

    
    register_rest_route was called <strong>incorrectly</strong>. The REST API route definition for <code>post-views-counter/view-post</code> is missing the required <code>permission_callback</code> argument. For REST API routes that are intended to be public, use <code>__return_true</code> as the permission callback.
    

    and second

    
    register_rest_route was called <strong>incorrectly</strong>. The REST API route definition for <code>post-views-counter/update-post-views</code> is missing the required <code>permission_callback</code> argument. For REST API routes that are intended to be public, use <code>__return_true</code> as the permission callback. 
    

    Fixed by adding a line
    ‘permission_callback’ => ‘__return_true’,
    here

    
    File: includes/counter.php
    748: 		register_rest_route( 'post-views-counter', '/view-post/', array(
    
    

    and there

    
    File: includes/columns.php
    57: 	public function gutenberg_rest_api_init() {
    
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Missed “permission_callback”’ is closed to new replies.