Skip to main content
added 117 characters in body
Source Link
Rarst
  • 100k
  • 10
  • 161
  • 298

Not tested this out thoroughly, but I think it's preferable to remove underlying resource rather than try to build walls around it on web server level. So in WP terms that would be stopping it from processing author-related query variables.

if ( ! is_admin() ) {
    add_filter(
        'query_vars',
        function ( $public_query_vars ) {

            foreach ( array( 'author', 'author_name' ) as $var ) {
                $key = array_search( $var, $public_query_vars );
                if ( false !== $key ) {
                    unset( $public_query_vars[$key] );
                }
            }

            return $public_query_vars;
        }
    );
}

PS note that this will kill author archives entirely, which might or might not be appropriate paranoia level :)

Not tested this out thoroughly, but I think it's preferable to remove underlying resource rather than try to build walls around it on web server level. So in WP terms that would be stopping it from processing author-related query variables.

if ( ! is_admin() ) {
    add_filter(
        'query_vars',
        function ( $public_query_vars ) {

            foreach ( array( 'author', 'author_name' ) as $var ) {
                $key = array_search( $var, $public_query_vars );
                if ( false !== $key ) {
                    unset( $public_query_vars[$key] );
                }
            }

            return $public_query_vars;
        }
    );
}

Not tested this out thoroughly, but I think it's preferable to remove underlying resource rather than try to build walls around it on web server level. So in WP terms that would be stopping it from processing author-related query variables.

if ( ! is_admin() ) {
    add_filter(
        'query_vars',
        function ( $public_query_vars ) {

            foreach ( array( 'author', 'author_name' ) as $var ) {
                $key = array_search( $var, $public_query_vars );
                if ( false !== $key ) {
                    unset( $public_query_vars[$key] );
                }
            }

            return $public_query_vars;
        }
    );
}

PS note that this will kill author archives entirely, which might or might not be appropriate paranoia level :)

Source Link
Rarst
  • 100k
  • 10
  • 161
  • 298

Not tested this out thoroughly, but I think it's preferable to remove underlying resource rather than try to build walls around it on web server level. So in WP terms that would be stopping it from processing author-related query variables.

if ( ! is_admin() ) {
    add_filter(
        'query_vars',
        function ( $public_query_vars ) {

            foreach ( array( 'author', 'author_name' ) as $var ) {
                $key = array_search( $var, $public_query_vars );
                if ( false !== $key ) {
                    unset( $public_query_vars[$key] );
                }
            }

            return $public_query_vars;
        }
    );
}