How to customise the WordPress REST API URL prefix (wp-json). This snippet is for the https://hookturn.io/2021/10/how-to-customise-the-wordpress-rest-api-url-prefix-wp-json/ blog post.
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 | |
// This will replace the 'wp-json' REST API prefix with 'api'. | |
// Be sure to flush your rewrite rules for this change to work. | |
add_filter( 'rest_url_prefix', function () { | |
return 'api'; | |
} ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment