Screenshot WOW SAVE 20% on the All Access Bundle. Use "OAUTH20OFF" at checkout.
GET DEAL
3rd Party Integration

Custom Hooks

Published: December 29, 2019 | Updated: December 2nd, 2021
  1. Home
  2. Docs
  3. General
  4. Custom Hooks

Overview

WP OAuth Server is built using WordPress’s Coding Standards. The plugin offers ways to extend and customize specific aspects by utilizing WordPress’s Filter and Action API. WP OAuth Server uses Custom Hooks to create a developer-friendly system.

Filters

WP OAuth Server uses filters to control and allow customization of specific aspects of the plugin. Below are filters that you can use to customize WP OAuth Server. Use WordPress’s ‘add_filter‘ function to modify all filters.

  • wo_strict_api_lockdown
  • wo_www_realm
  • wo_token_param_name
  • wo_token_bearer_header_name
  • wo_allow_credentials_in_request_body
  • wo_allow_public_clients
  • wo_always_issue_new_refresh_token
  • wo_unset_refresh_token_after_use
  • wo_redirect_status_code
  • wo_pcke_challenge_method
  • wo_default_scope
  • wo_scopes
  • wo_use_grant_request
  • wpo_well_known_openid_configuration
  • wo_openid_discovery
  • wo_endpoints
  • wo_userclaims_email – Modify fields for the ’email’ claim while using OpenID
  • wo_userclaims_profile – Modify fields for the ‘profile’ claim while using OpenID
  • wo_userclaims_address – Modify fields for the ‘address’ claim while using OpenID
  • wo_userclaims_phone – Modify fields for the ‘address’ claim while using OpenID
  • wo_userclaims – Modify all fields for all claims being sent back while using OpenID

Extending Using a Plugin (Recommended)

Extending any WordPress plugin or theme by plugin recommend. It is the best way to provide custom code while maintaining the original code integrity of themes and plugins. We have provided a starter plugin that will allow you to get started fast.

Download the latest starter plugin

https://github.com/justingreerbbi/Starter-WordPress-Plugin/releases/latest/

Once you have the plugin downloaded and installed on your WordPress site, you can edit
/wp-content/plugins/starter-wordpress-plugin/starter-wordpress-plugin.php with your favorite editor.

The main starter-wordpress-plugin.php is where you can add any custom code to extend WP OAuth Server. Simply install the starter plugin and ensure it is activated.

DO NOT USE THE WORDPRESS PLUGIN EDITOR

Extending using Current Theme

Extending using a theme’s function.php file is often the fastest way to add custom code to any WordPress website. It, however, can be dangerous because the theme can be updated out of control of you. You can lose all changes made if you don’t use a child theme properly.

Using your favorite editor, find your theme’s function.php file. At the end of the file, you can append any new code for extending WP OAuth Server. you can find more information about a theme’s functions.php file and where to find it at https://developer.wordpress.org/themes/basics/theme-functions/.

Icon