Code-Snippets-Functions/Execute a function on a child site/WordPress/block-user-enumeration-attempts.txt

9 lines
329 B
Text

function wp_block_user_enumeration_attempts() {
if ( is_admin() ) return;
$author_by_id = ( isset( $_REQUEST['author'] ) && is_numeric( $_REQUEST['author'] ) );
if ( $author_by_id )
wp_die( 'Author archives have been disabled.' );
}
add_action( 'template_redirect', 'wp_block_user_enumeration_attempts' );