In Notion, when I paste a wordpress page or post link into a note, the “mention” feature appears. When you use this feature, it adds the author username of the page or post into the note. I want to turn this off. In fact, my only goal is to prevent wp usernames from leaking out.
I tried the code below, this code sends the endpoint “/wp-json/wp/v2/users/1” to 404, but Notion can still somehow find the username.
<?php
function disable_users_endpoint( $endpoints ) {
if ( isset( $endpoints['/wp/v2/users'] ) ) {
unset( $endpoints['/wp/v2/users'] );
}
if ( isset( $endpoints['/wp/v2/users/(?P<id>[\d]+)'] ) ) {
unset( $endpoints['/wp/v2/users/(?P<id>[\d]+)'] );
}
return $endpoints;
}
add_filter( 'rest_endpoints', 'disable_users_endpoint' );
?>