skip to Main Content

WordPress Code Snippets


Change the Default User Role for New Users

Set the default user role to “Editor” when new users register.

add_filter('pre_option_default_role', 'codebykp_set_default_user_role');
function codebykp_set_default_user_role() {
    return 'editor';
}


I’m a WordPress developer with 10+ years of experience in WooCommerce and custom plugins. I combine technical expertise with design flair to help you create standout, user-friendly websites. Let’s transform your digital presence!

Best WordPress Hosting
Back To Top
Search