Skip to content

Instantly share code, notes, and snippets.

@BurlesonBrad
Created April 24, 2019 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BurlesonBrad/29cf54cd16e35a11cdea9f7e488469b3 to your computer and use it in GitHub Desktop.
Save BurlesonBrad/29cf54cd16e35a11cdea9f7e488469b3 to your computer and use it in GitHub Desktop.
Miranda: Add these two snippets to the "Code Snippets" plugin.
function redirect_to_home_if_author_parameter() {
$is_author_set = get_query_var( 'author', '' );
if ( $is_author_set != '' && !is_admin()) {
wp_redirect( home_url(), 301 );
exit;
}
}
add_action( 'template_redirect', 'redirect_to_home_if_author_parameter' );
/* Then this snippet as well */
function disable_rest_endpoints ( $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_rest_endpoints');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment