Opened 9 years ago
Closed 7 years ago
#34034 closed enhancement (fixed)
Hook for Page Attributes Metabox
Reported by: | markcallen | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | has-patch |
Focuses: | administration | Cc: |
Description
The publish metabox provides two hooks to add additional information/elements to it.
post_submitbox_misc_actions attachment_submitbox_misc_actions
It would be trivial to add a similar hook to the Page Attributes meta box - is there any reason why this can't be done?
Adding page related meta in an entirely new metabox isn't great for UX - two places for page attributes is silly.
There are several solutions touted in the wild ranging from hacking core to removing and recreating the metabox manually or inserting the elements with javascript - none good solutions.
The addition of a single hook would allow much better practice to be adopted in adding options to this metabox.
do_action( 'page_attributes_misc_actions' );
Attachments (3)
Change History (23)
#2
@
9 years ago
- Keywords has-patch removed
This adds a hook to the Publish (aka submitbox) - this ticket refers to the Page Attributes metabox.
The post_submitbox_misc_actions
hook is sufficient because you can test for post types in the callback.
It just needs, in my opinion, do_action( 'page_attributes_misc_actions' );
adding in or around L777 of the wp-admin/meta-boxes.php file.
#3
@
9 years ago
Let me know if 34034.2.diff covers what you are looking for. I placed it after the default attributes.
#5
@
8 years ago
This has been sat here for well over a year - it's simple, it has a patch and it's ready to go.
Is there a good any reason for this not being committed - or even reviewed?
Be good to have some feedback at least.
#6
follow-up:
↓ 7
@
8 years ago
@markcallen
Patch is valid and still applies cleanly.
https://core.trac.wordpress.org/browser/tags/4.7.2/src/wp-admin/includes/meta-boxes.php#L833
#7
in reply to:
↑ 6
@
8 years ago
Replying to lukecavanagh:
@markcallen
Patch is valid and still applies cleanly.
https://core.trac.wordpress.org/browser/tags/4.7.2/src/wp-admin/includes/meta-boxes.php#L833
Thanks @lukecavanagh.
It's a very simple patch that makes WordPress more extensible. It just needs to be committed, or if there are any reasons for not (personally, I can't think of any), then the points need raising to be discussed.
#8
@
8 years ago
- Component changed from Options, Meta APIs to Posts, Post Types
- Keywords needs-refresh added
- Milestone changed from Awaiting Review to 4.8
page_attributes_misc_attributes
might be a better name, as there are no actions in this box.
34034.diff adds a new hook that fires directly after
post_submitbox_misc_actions
.post_submitbox_misc_actions
fires on pages and the post object is passed in so it could be targeted that way but this still seems beneficial for specific post types. This hook also works for other post_types besides pages that may use the same metabox, which could be a lot.