Opened 3 years ago
Last modified 3 weeks ago
#53405 new enhancement
short circuit before current filters for get_edit_user_link
Reported by: | shawfactor | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Users | Keywords: | has-patch |
Focuses: | multisite, performance | Cc: |
Description
currently the function get_edit_user_link can be filtered BUT it is only after it has gone searching for an appropriate value.
This is problematic as on multisite this search may call get_edit_profile_url and then get_dashboard_url which in turn then runs get_blogs_of_user which pulls all the options for every site that the user is a member of into memory. This can be huge and completely unnecessary!!
There needs to be a way to short cicuit this function at the start before all this occurs.
Change History (4)
#1
@
3 years ago
- Summary changed from short circuit before current filters to short circuit before current filters for get_edit_user_link
This ticket was mentioned in Slack in #core by peterwilsoncc. View the logs.
3 years ago
#3
@
3 years ago
- Component changed from General to Users
- Focuses multisite performance added
- Keywords needs-patch added
This ticket was mentioned in PR #7641 on WordPress/wordpress-develop by @debarghyabanerjee.
3 weeks ago
#4
- Keywords has-patch added; needs-patch removed
Trac Ticket: Core-53405
## Description
- This pull request introduces a mechanism for short-circuiting the get_edit_user_link function in order to improve performance, especially in multisite environments. The implementation allows for early exits from the function when certain conditions are met, minimizing unnecessary processing and memory usage.
## Changes Made
- Added a
filter pre_get_edit_user_link
to allow early return of a custom edit link.
- Refactored the function to check the filter result at the beginning, enabling short-circuit behavior before any resource-intensive operations are performed.
- Updated the function documentation to include the new filter, providing clarity on its usage and purpose.
## Benefits
- Performance Improvement
- Reduces overhead in scenarios where the edit user link can be determined early, preventing heavy operations in multisite setups.
- Enhanced Flexibility
- Allows developers to customize the edit user link easily via the new filter without modifying core logic.
Hello @shawfactor! Thank you for reporting this. We recently reviewed this ticket during a recent triage session. Based on the feedback provided by the team, we have changed the component of the ticket to Users; added Multisite focus; and added needs-patch keyword. Cheers!
Props to @peterwilsoncc & @mikeschroder