Support » Plugin: Disable REST API » Disable by Role

  • Resolved dleeward

    (@dleeward)


    Is this plugin coded in a way that we could modify it to restrict/allow access to users by role?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Dave McHale

    (@dmchale)

    Sure, you can tap into the dra_allow_rest_api filter. It currently returns true/false based on whether the user is logged in or not, but you could add some role-checking into that logic with the filter.

    If TRUE is returned, then the plugin does nothing and all endpoints are available. If FALSE is returned, then the plugin performs its normal function. There is not currently a way to create custom endpoint whitelists for individual roles, however.

    dleeward

    (@dleeward)

    Thanks for the response. We ended up using code from here: https://maddisondesigns.com/2016/12/what-you-may-not-know-about-the-wp-rest-api/

    Plugin Author Dave McHale

    (@dmchale)

    Cheers @dleeward, glad you found a solution 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Disable by Role’ is closed to new replies.