Created
February 21, 2018 20:44
-
-
Save IacopoC/86a0f13d3b5db38be8fd1e855172fede to your computer and use it in GitHub Desktop.
Get core update in Rest Api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_wp_core_updates() { | |
require_once ABSPATH . '/wp-admin/includes/update.php'; | |
return get_core_updates(); | |
} | |
add_action( 'rest_api_init', function () { | |
register_rest_route( 'wp/v2', 'wp-version',array( | |
'methods' => 'GET', | |
'callback' => 'get_wp_core_updates' | |
) ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment