Hi
here is the real fix to this issue dealing with all options and settings and get rid of the notice.
static public function disable_author_page() {
$authorrequest = FALSE;
$request = ( isset( $_SERVER[ 'REQUEST_URI' ] ) ? $_SERVER[ 'REQUEST_URI' ] : $_SERVER[ 'SCRIPT_NAME' ] . ( ( isset( $_SERVER[ 'QUERY_STRING' ] ) ? '?' . $_SERVER[ 'QUERY_STRING' ] : '') ) );
if ( is_404() && stripos( $request, '/author/' ) == 0 ) {
if ( get_option( 'disable_author_pages_redirect_non_authors' ) == 1 ) {
$authorrequest = TRUE;
}
}
if ( is_404() && stripos( $request, '/author/' ) === false ) {
return;
}
if ( ( is_author() || $authorrequest ) && get_option( 'disable_author_pages_activate' ) == 1 ) {
$adminonly = get_option( 'disable_author_pages_adminonly', '0' );
$author_can=false;
if (!is_404() && $adminonly) {
global $post;
if( is_object($post)) {
$author_can = author_can( get_the_ID(), 'administrator');
}
}
if ( $adminonly && $author_can===true || !$adminonly && !is_404() || is_404() && ( get_option( 'disable_author_pages_redirect_non_authors' ) == 1 ) ) {
$status = get_option( 'disable_author_pages_status', '301' );
$url = get_option( 'disable_author_pages_destination', '' );
if ( $url == '' ) {
$url = home_url();
}
wp_redirect( $url, $status );
exit;
}
}
}
Best regards,