Deactivate WordPress registration — here’s how!

Marc Wag­ner

Octo­ber 11, 2024

1 min read|

To deac­ti­va­te the default regis­tra­ti­on page of Word­Press (/wp-login.php?action=register) and at the same time enable regis­tra­ti­on via Woo­Com­mer­ce, you can do the fol­lo­wing:

Add the fol­lo­wing code to the functions.php file of your the­me or use a plug­in for cus­tom code snip­pets to avo­id direct chan­ges to the the­me files:

function disable_wp_registration() {
    if (isset($_GET['action']) && $_GET['action'] == 'register' && !is_admin()) {
        wp_redirect(home_url());
        exit;
    }
}
add_action('login_init', 'disable_wp_registration');

This code checks if someone is try­ing to access the Word­Press regis­tra­ti­on page and then redi­rects them to the home page (or any other page you pre­fer).

88e86fcb816eff22bc917094df2862d8dd5c0e978b333e6dd5f36f808990c261 96

Arti­kel von:

Marc Wag­ner

Hi Marc here. I’m the foun­der of Forge12 Inter­ac­ti­ve and have been pas­sio­na­te about buil­ding web­sites, online stores, appli­ca­ti­ons and SaaS solu­ti­ons for busi­nesses for over 20 years. Befo­re foun­ding the com­pa­ny, I alre­a­dy work­ed in publicly lis­ted com­pa­nies and acqui­red all kinds of know­ledge. Now I want to pass this know­ledge on to my cus­to­mers.

Hast du eine Fra­ge? Hin­ter­lass bit­te einen Kom­men­tar