Opened 14 hours ago
#65254 new enhancement
wp_signup_url() function proposal
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Networks and Sites | Keywords: | |
| Focuses: | multisite | Cc: |
Description
Hello everyone,
I noticed that WordPress already provides several helper functions to retrieve authentication-related URLs, such as:
wp_login_url() wp_logout_url() wp_registration_url()
However, there does not seem to be an equivalent function for retrieving the Multisite signup URL.
Developers currently need to manually build or retrieve the signup URL, typically using network_site_url( 'wp-signup.php' ). This may create inconsistency and make registration/signup URL handling less uniform.
Additionally, WordPress already relies in multiple places on the following filter:
apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) );
This seems to indicate that there is already a need for a centralized and filterable signup URL mechanism, but currently there is no dedicated global helper function encapsulating this behavior.
I would like to propose adding a new function:
wp_signup_url()
Possible behavior:
- In Multisite, return the filtered network signup page URL.
- In non-Multisite installations, it could return
wp_registration_url().
Example implementation idea:
<?php function wp_signup_url() { if( is_multisite() ) { return apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ); } return wp_registration_url(); }
Benefits:
- Improves API consistency.
- Centralizes signup URL generation logic.
- Ensures consistent application of the wp_signup_location filter.
- Simplifies plugin and theme development.
- Avoids repeated custom implementations across projects.
- Provides a clearer semantic distinction between registration and Multisite signup flows..
I’d be happy to hear feedback about the preferred behavior for non-Multisite installations and whether this could be a useful addition to Core.