Opened 8 years ago
Closed 7 years ago
#37446 closed enhancement (fixed)
Introduce a filter for `self_admin_url()`
Reported by: | flixos90 | Owned by: | flixos90 |
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | Administration | Keywords: | has-patch has-unit-tests |
Focuses: | multisite | Cc: |
Description
I'm currently building a plugin which includes an additional administration panel (like the network or user admin). However, the function self_admin_url()
is impossible to adjust to that new functionality. I would like to be able to have it return the admin URL to my new administration panel if it is active.
Therefore I propose to introduce a new filter self_admin_url
for the function. A developer could hook into that, check whether the custom administration panel is currently active and then adjust the returned URL accordingly.
Attachments (3)
Change History (10)
#3
@
8 years ago
- Milestone changed from Awaiting Review to Future Release
+1. We should probably also pass the $scheme
value to the filter for completeness.
#5
@
8 years ago
In 37446.2.diff I added the $scheme
parameter.
#6
@
7 years ago
- Keywords has-unit-tests added
- Milestone changed from Future Release to 4.9
- Owner set to flixos90
- Status changed from new to assigned
In 37446.3.diff I added a few unit tests for self_admin_url()
.
It's currently not possible to test the function further without hacking a lot, since there is no way to influence function outcomes from e.g. is_network_admin()
, since WP_Screen
is final and cannot be mocked. The few tests that are there now at least perform the most basic checks and ensure the filter works.
37446.diff introduces the filter.