ERROR: Agency Toolkit

Failed to save settings for Stop User Enumeration. Please check the wp-config.php and .htaccess permissions on your web server'.

' . "\n" . 'RewriteCond %{REQUEST_URI} ^/$' . "\n" . 'RewriteCond %{QUERY_STRING} ^/?author=([0-9]*)' . "\n" . 'RewriteRule ^(.*)$ ' . $site_url . '? [L,R=301]' . "\n" . ''; if ( ! inspry_toolkit_htaccess_append( $rule ) ) { add_action( 'admin_notices', 'inspry_toolkit_show_error' ); } } // Set up function to check for the rule function inspry_toolkit_check_user_enumeration_rule() { $htaccess_search_for = '# AGENCY TOOLKIT - STOP USER ENUM'; $htaccess_file = inspry_toolkit_htaccess_read(); if ( strpos( $htaccess_file, $htaccess_search_for ) === false ) { return true; } else { return false; } } // Make sure we haven't already written the rule function inspry_toolkit_run_stop_user_emun_rule() { if ( !is_admin() ) { // default URL format // QUERY_STRING is not set under WP-CLI or cron. if ( isset( $_SERVER['QUERY_STRING'] ) && preg_match( '/author=([0-9]*)/i', sanitize_text_field( wp_unslash( $_SERVER['QUERY_STRING'] ) ) ) ) { die( ); } add_filter( 'redirect_canonical', 'inspry_toolkit_check_enum', 10, 2 ); //Disable REST API endpoints to get user details add_filter( 'rest_endpoints', function( $endpoints ){ if ( isset( $endpoints['/wp/v2/users'] ) ) { unset( $endpoints['/wp/v2/users'] ); } return $endpoints; } ); } function inspry_toolkit_check_enum( $redirect, $request ) { // permalink URL format if ( preg_match( '/\?author=([0-9]*)(\/*)/i', $request ) ){ die( ); }else{ return $redirect; } } // The PHP checks above always run; the .htaccess rule only where it can take effect. if ( inspry_toolkit_htaccess_applies() && inspry_toolkit_check_user_enumeration_rule() ) { // Write the fuke inspry_toolkit_stop_user_enumeration_rule(); } } add_action( 'init', 'inspry_toolkit_run_stop_user_emun_rule' );