Created
April 24, 2019 19:27
-
-
Save BurlesonBrad/29cf54cd16e35a11cdea9f7e488469b3 to your computer and use it in GitHub Desktop.
Miranda: Add these two snippets to the "Code Snippets" plugin.
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
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