Make WordPress Core

Opened 11 years ago

Closed 9 years ago

#34034 closed enhancement (fixed)

Hook for Page Attributes Metabox

Reported by: markcallen Owned by: SergeyBiryukov
Priority: normal Milestone: 4.9
Component: Posts, Post Types Version:
Severity: normal Keywords: has-patch
Cc: Focuses: administration

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)

34034.diff​ (700 bytes ) - added by MikeHansenMe 11 years ago.
34034.2.diff​ (983 bytes ) - added by MikeHansenMe 11 years ago.
34034.3.diff​ (1017 bytes ) - added by markcallen 10 years ago.
Updated for inclusion in 4.8

Download all attachments as: .zip

Change History (23)

#1 @MikeHansenMe
11 years ago

  • Keywords has-patch added

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.

#2 @markcallen
11 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 @MikeHansenMe
11 years ago

Let me know if 34034.2.diff​ covers what you are looking for. I placed it after the default attributes.

#4 @markcallen
11 years ago

  • Keywords has-patch added

Works for me, thanks Mike.

#5 @markcallen
10 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: @lukecavanagh
10 years ago

Last edited 10 years ago by lukecavanagh (previous) (diff)

#7 in reply to: ↑ 6 @markcallen
10 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 @SergeyBiryukov
10 years ago

  • Component Options, Meta APIs → Posts, Post Types
  • Keywords needs-refresh added
  • Milestone Awaiting Review → 4.8

page_attributes_misc_actions might be a better name, as there are no actions in this box.

Version 0, edited 10 years ago by SergeyBiryukov (next)

@markcallen
10 years ago

Updated for inclusion in 4.8

#9 @markcallen
10 years ago

  • Keywords needs-refresh removed

Thanks @SergeyBiryukov.

Patch is refreshed.

#10 @jbpaul17
10 years ago

  • Keywords needs-testing added

This ticket was mentioned in ​Slack in #core by jeffpaul. ​View the logs.


10 years ago

#12 @Braad
10 years ago

Yes please! Patch looks good.

#13 @jbpaul17
10 years ago

  • Keywords needs-testing removed

This ticket was mentioned in ​Slack in #core by jeffpaul. ​View the logs.


10 years ago

#15 @jbpaul17
10 years ago

  • Milestone 4.8 → 4.8.1

Punting to 4.8.1 per today's bug scrub.

#16 @SergeyBiryukov
9 years ago

  • Milestone 4.8.1 → 4.9

This ticket was mentioned in ​Slack in #core by jeffpaul. ​View the logs.


9 years ago

This ticket was mentioned in ​Slack in #core by jeffpaul. ​View the logs.


9 years ago

This ticket was mentioned in ​Slack in #core by jeffpaul. ​View the logs.


9 years ago

#20 @SergeyBiryukov
9 years ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → closed

In 41763:

Posts, Post Types: Introduce page_attributes_misc_attributes action that fires before the help hint text in the 'Page Attributes' meta box.

Props markcallen, MikeHansenMe.
Fixes #34034.

Note: See TracTickets for help on using tickets.