Opened 11 months ago
Closed 11 months ago
#21071 closed enhancement (fixed)
Do a load action in admin.php for importers
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.5 |
| Component: | Import | Version: | |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: |
Description
Every type of page in the admin area has an equivalent load-[whatever] type action, which is triggered before any HTML has been rendered. This is handy if a plugin needs to process some data which might require a redirect header to be set, or to affect HTML which is rendered before the admin screen main content (e.g. admin notices).
The exception to the rule is the importers. I propose adding an action which would allow plugins and themes to execute code at this point as easily as they can in other areas of WP admin.
Attachments (1)
Change History (8)
simonwheatley — 11 months ago
comment:1
simonwheatley — 11 months ago
- Keywords commit added; dev-feedback removed
- Milestone changed from Awaiting Review to 3.5
I think 'load-importer-' is a good precaution.
I can go for something like this. Not sure if I like the idea of modeling it after "load-*", as those hooks are specifically acting on $hook_suffix, while in this case the hook suffix would be "admin.php". Either way, namespacing it so it is load-importer-$importer or "import_$importer" or "load_importer_$importer" seems good to me.
comment:4
simonwheatley — 11 months ago
I chose load-importer-$importer as it indicates the similarity with the other load-$whatever hooks. Personally I favour dashes in hooks, and again this would be consistent with the other load-$whatever hooks.
I am satisfied with the use case presented here as well as 21701-sw-1.diff. Leaving this for duck_ and westi to weigh in.
Replying to nacin:
I am satisfied with the use case presented here as well as 21701-sw-1.diff. Leaving this for duck_ and westi to weigh in.
Looks good to me.

Diff adds do_action("load-importer-$importer"); into admin.php within this block of the conditional where the other load actions are triggered. The use of "load-importer" rather than "load-" is to get around the possible problems of having a plugin page hook which clashes… but perhaps I'm wrong or overly concerned?