Exciting News! Flipper Code is now WePlugins! Same commitment to excellence, brand new identity.

How to use network_site_new_created_user action in WordPress

Sandeep Kumar Mishra
Sandeep Kumar Mishra
October 22, 2022
5 minutes read

So, you’re looking to understand the network_site_new_created_user action in WordPress? This hook fires after a new user is created via the network site-new.php page. It’s pretty handy for custom functionality when a new user joins your network. Let me break it down for you with some examples!

Access Premium WordPress Plugins

Live Example 1

This example demonstrates how to use the network_site_new_created_user action to execute a custom function when a new user is created.

    function weplugins_execute_on_network_site_new_created_user_event($user_id){
        // Your custom code here
    }
    // Add the action
    add_action("network_site_new_created_user", "weplugins_execute_on_network_site_new_created_user_event", 10, 1);
    

Live Example 2

Here’s how you can remove a hook callback using remove_action for the network_site_new_created_user action.

    // Remove the action
    remove_action("network_site_new_created_user", "weplugins_execute_on_network_site_new_created_user_event", 10, 1);
    

Live Example 3

Let’s say you want to log the user ID of the newly created user. This example shows how to do that.

    function weplugins_log_new_user_id($user_id){
        error_log("A new user has been created with ID: " . $user_id);
    }
    // Add the action
    add_action("network_site_new_created_user", "weplugins_log_new_user_id", 10, 1);
    

If you need any customization or run into issues using this hook, feel free to Contact Us for professional assistance. Visit WePlugins Contact Page.

Sandeep Kumar Mishra

Sandeep Kumar Mishra

Sandeep Kumar Mishra writes about WordPress and Artificial Intelligence, offering tips and guides to help you master your website and stay updated with the latest tech trends.

Explore the latest in WordPress

Trying to stay on top of it all? Get the best tools, resources and inspiration sent to your inbox every Wednesday.