Created
January 12, 2018 06:24
-
-
Save shivapoudel/b822b4b95e7aa2fe1cc0d75da4b26563 to your computer and use it in GitHub Desktop.
WP REST API - Modify API base URL prefix.
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 // Do not include this if already open! | |
/** | |
* Code goes in theme functions.php. | |
*/ | |
add_filter( 'rest_url_prefix', 'custom_rest_url_prefix' ); | |
/** | |
* Modify url base from 'wp-json' to 'api' prefix. | |
*/ | |
function custom_rest_url_prefix() { | |
return 'api'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment