Retours audit XMCO
This commit is contained in:
parent
dce898286d
commit
87ef0fb5c7
2 changed files with 38 additions and 0 deletions
|
|
@ -932,3 +932,10 @@ RewriteRule . /index.php [L]
|
|||
</IfModule>
|
||||
|
||||
# END WordPress
|
||||
|
||||
# Block WordPress xmlrpc.php requests
|
||||
<Files xmlrpc.php>
|
||||
order deny,allow
|
||||
deny from all
|
||||
</Files>
|
||||
|
||||
|
|
|
|||
|
|
@ -1037,3 +1037,34 @@ function writeLog($log)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Require Authentication for All Requests FOR REST API
|
||||
*/
|
||||
|
||||
add_filter( 'rest_authentication_errors', function( $result ) {
|
||||
// If a previous authentication check was applied,
|
||||
// pass that result along without modification.
|
||||
if ( true === $result || is_wp_error( $result ) ) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
// No authentication has been performed yet.
|
||||
// Return an error if user is not logged in.
|
||||
if ( ! is_user_logged_in() ) {
|
||||
return new WP_Error(
|
||||
'rest_not_logged_in',
|
||||
__( 'You are not currently logged in.' ),
|
||||
array( 'status' => 401 )
|
||||
);
|
||||
}
|
||||
|
||||
// Our custom authentication check should have no effect
|
||||
// on logged-in requests
|
||||
return $result;
|
||||
});
|
||||
|
||||
/**
|
||||
* disable XML-RPC
|
||||
*/
|
||||
add_filter( 'xmlrpc_enabled', '__return_false' );
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue