Skip to content

Instantly share code, notes, and snippets.

@jconroy
Last active November 28, 2018 16:14
Show Gist options
  • Save jconroy/180d629543437eaf765dafdf82aa2524 to your computer and use it in GitHub Desktop.
Save jconroy/180d629543437eaf765dafdf82aa2524 to your computer and use it in GitHub Desktop.
WP Login Page API Disovery
<?php
/*
Plugin Name: WP Login Page API Disovery
Plugin URI: https://gist.github.com/jconroy/180d629543437eaf765dafdf82aa2524
Description: Adds the WP REST API link header and link element to the wp-login.php page.
Author: Robot Ninja, Jason Conroy
Version: 1.0
Author URI: https://robotninja.com
*/
// A REST API link element to login page head
if ( function_exists( 'rest_output_link_wp_head' ) ) {
add_action( 'login_head', 'rest_output_link_wp_head', 10, 0 );
}
// Add REST API link header to login page http response
if (function_exists( 'rest_output_link_header' )) {
add_action( 'login_init', 'rest_output_link_header', 11, 0 );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment