#51177 closed enhancement (invalid)
Add filters in the attachment_submitbox_metadata function
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | |
Component: | Media | Keywords: | |
Focuses: | template | Cc: |
Description
In wp-admin/includes/media.php line 3249, the function
function attachment_submitbox_metadata() {
this function has no filter, so it's not possible to hook into it without to copy the function, but doing so would miss on any upgrade made to this function.
I don't know why there is no filters in this function, maybe there is a good explanation I didn't think about ?
The goal for me is to add the same div
.misc-pub-section.mis-pub-filename
used by the admin but with my own html.
Change History (4)
#2
@
5 years ago
- Keywords close 2nd-opinion added
Going to mark this as close
and 2nd-opinion
. As @Mista-Flo mentioned you can add additional .misc-pub-section
element by adding a custom hook onto the attachment_submitbox_misc_actions
action. If you give it a priority less than 10 it'll place your custom items prior to the existing sections, if you give it a priority greater than 10 it'll place your custom items after the existing sections.
Hi @Jean-David, welcome and thank you for your ticket :)
I'm not sure adding some hooks here would be a good idea. I checked, and it was the same for the submit metabox for posts. You still have an action hook. But usually, for this metabox, I used to just manually add some custom HTML with JS code.
I advise you to use the
attachment_submitbox_misc_actions
hook, which is used once by the core itself to add some elements.