Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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.
<?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