Lock the "New User Default Role" setting so new sign-ups always get the role you choose, even if someone changes the setting.
add_filter( 'pre_option_default_role', function (): string {
return 'subscriber';
} );
Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.
If the “New User Default Role” setting is ever changed to Editor or Administrator, by mistake or by an attacker, every new sign-up gets that power. This snippet fixes the role in code so the setting can’t be changed.
pre_option_default_role runs before WordPress reads the setting from the database. Returning a role name skips the database value completely, so the setting always says Subscriber.
'subscriber' to another role, such as 'customer' for WooCommerce stores.Go to Settings → General, change New User Default Role to Editor and save. Reload: it should still say Subscriber.