Make WordPress Core

Opened 23 months ago

Closed 4 days ago

#26267 closed enhancement (fixed)

Do action before #minor-publishing-actions in publish meta-box

Reported by: jonathanbardo Owned by: chriscct7
Milestone: 4.4 Priority: normal
Severity: normal Version:
Component: Editor Keywords: has-patch commit
Focuses: administration Cc:


I've stumble on a use case where we would have to create a custom preview button on the publish meta-box.

There is currently no hook to add custom content at the end of the #minor-publishing-actions div.

I propose adding a hook right before the division is closed.

Attachments (4)

26267.diff (447 bytes) - added by jonathanbardo 23 months ago.
26267.2.diff (471 bytes) - added by jonathanbardo 20 months ago.
Change name of action
26267.patch (590 bytes) - added by chriscct7 10 days ago.
26267.2.patch (1022 bytes) - added by DrewAPicture 4 days ago.
+ $post parameter

Download all attachments as: .zip

Change History (17)

@jonathanbardo23 months ago

comment:1 @helen20 months ago

  • Keywords 2nd-opinion added

Adding a hook here is making me nervous for some reason, even though I usually love hooks on the edit screen. The publish metabox is already so cluttered and maintaining compat with hooks can make rethinking difficult. Would like some more opinions here.

comment:2 @mordauk20 months ago

I would prefer having the option that might result in a little clutter due to plugins than to not have the option.

comment:3 follow-up: @helen20 months ago

I think I'm more worried about maintaining compat into the future :)

comment:4 in reply to: ↑ 3 @mordauk20 months ago

Replying to helen:

I think I'm more worried about maintaining compat into the future :)

Maybe I'm just being daft but I'm having trouble thinking of compatibility issues this might raise in the future. Could you give me an example?

comment:5 @jonathanbardo20 months ago

I'm also having problem with foreseeing compatibilities issues. Right now the only way we can add a custom button to the publish meta-box is at the end. Having a hook here would make it more flexible.

comment:6 @SergeyBiryukov20 months ago

  • Component changed from General to Editor

comment:7 @SergeyBiryukov20 months ago

Related: #25279, #12567.

If we add a hook in there, it should probably be named post_submitbox_minor_actions for consistency with post_submitbox_misc_actions added in [12000], and go above <div class="clear"></div>.

@jonathanbardo20 months ago

Change name of action

comment:8 @chriscct710 days ago

  • Focuses administration added
  • Keywords has-patch added; 2nd-opinion removed
  • Milestone changed from Awaiting Review to 4.4
  • Owner set to chriscct7
  • Status changed from new to accepted

comment:9 @chriscct710 days ago

  • Keywords needs-docs added

Just needs docs

@chriscct710 days ago

comment:10 @chriscct710 days ago

  • Keywords commit added; needs-docs removed

comment:11 @wonderboymusic4 days ago

  • Keywords needs-refresh added; commit removed

both of those actions should have $post passed to them to not have to rely on globals, which are gross

@DrewAPicture4 days ago

+ $post parameter

comment:12 @DrewAPicture4 days ago

  • Keywords commit added; needs-refresh removed

26267.2.patch adds a $post parameter to both the new hook and the post_submitbox_misc_actions hook (with a changelog entry).

comment:13 @wonderboymusic4 days ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 34895:

Meta Boxes: add an action, post_submitbox_minor_actions. post_submitbox_misc_actions already exists. Pass $post to both for context - avoids having to check for a global post.

Props jonathanbardo, chriscct7, DrewAPicture.
Fixes #26267.

Note: See TracTickets for help on using tickets.