Making WordPress.org


Ignore:
Timestamp:
10/26/2021 04:05:15 AM (3 years ago)
Author:
dd32
Message:

Plugin Directory: API: Add permission_callback to all the public API endpoints, to avoid _doing_it_wrong().

'register_rest_route was called <strong>incorrectly</strong>. The REST API route definition for <code>plugins/v1/query-plugins/?</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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-popular-tags.php

    r6287 r11297  
    1414    function __construct() {
    1515        register_rest_route( 'plugins/v1', '/popular-tags/?', array(
    16             'methods'  => WP_REST_Server::READABLE,
    17             'callback' => array( $this, 'popular_tags' ),
     16            'methods'             => WP_REST_Server::READABLE,
     17            'callback'            => array( $this, 'popular_tags' ),
     18            'permission_callback' => '__return_true',
    1819        ) );
    1920    }
Note: See TracChangeset for help on using the changeset viewer.