WordPress.org

Make WordPress Core

Opened 13 months ago

Closed 11 months ago

Last modified 11 months ago

#23929 closed enhancement (fixed)

Ability to remove post format UI

Reported by: johnbillion Owned by:
Milestone: 3.6 Priority: normal
Severity: normal Version: 3.6
Component: Post Formats Keywords: has-patch
Focuses: Cc:

Description

As discussed in IRC there should be a filter to completely remove the post format UI from the post editing screen.

Patch coming up.

Attachments (2)

23929.patch (875 bytes) - added by johnbillion 13 months ago.
23929.2.patch (890 bytes) - added by johnbillion 13 months ago.

Download all attachments as: .zip

Change History (23)

johnbillion13 months ago

comment:2 follow-up: johnbillion13 months ago

  • Keywords has-patch added

Patch which adds a new show_post_format_ui filter (boolean) for disabling the post format UI on the post editing screen.

Example usage:

add_filter( 'show_post_format_ui', '__return_false' );

or

add_filter( 'show_post_format_ui', function( $show, $post_type ) {
	if ( 'my_post_type' == $post_type )
		return false;
	return $show;
}, 10, 2 );

I toyed with the idea of removing the post format icons that are shown next to posts on the post listing screen too, but decided they should not be affected by this filter. They're easy enough to hide with CSS anyway.

comment:3 SergeyBiryukov13 months ago

Could you replace and operator with && for consistency with other conditionals?

Looks we don't use the first one in core.

comment:4 nacin13 months ago

I'm thinking we should pass $post in, not just $post_type. And I agree on the operator change. You can fall into precedence traps very easily with and and or.

comment:5 SergeyBiryukov13 months ago

  • Milestone changed from Awaiting Review to 3.6

johnbillion13 months ago

comment:6 johnbillion13 months ago

Patch refreshed.

comment:7 SergeyBiryukov13 months ago

Maybe 'show_post_formats_ui' vs 'show_post_format_ui'?

comment:8 SergeyBiryukov13 months ago

#23990 was marked as a duplicate.

comment:9 batmoo13 months ago

  • Cc batmoo@… added

comment:10 follow-up: batmoo13 months ago

Bringing my note from #23990 here: it would be nice to continue to maintain support for selective post formats as was possible before (e.g. I only want my theme/site to use the gallery post format) as well as just completely disabling it.

comment:11 ethitter13 months ago

  • Cc erick@… added

comment:12 follow-up: ryan13 months ago

If the filter returns false, should we should add_meta_box() on post_format_meta_box() so the old UI comes back?

comment:13 in reply to: ↑ 12 nacin13 months ago

Replying to ryan:

If the filter returns false, should we should add_meta_box() on post_format_meta_box() so the old UI comes back?

I'd argue no — that should be a separate add_meta_box() call. This is the "upgraded" meta box. If you want no UI, you can turn off the new UI. If you want the old UI, you should turn off the new UI *and* add it back.

It's also possible that we should interpret the post formats meta box being explicitly removed as the same as returning false through that filter. It depends on how other post format plugins/themes are manipulating the UI.

comment:14 ryan13 months ago

In 23946:

Allow turning off the post formats UI via a show_post_format_ui filter.

Props johnbillion
see #23929

comment:15 nacin12 months ago

In 24063:

Rename the show_post_format_ui filter to enable_post_format_ui. 'show' is a different concept - this filter entirely disables the UI. see #23929.

comment:16 in reply to: ↑ 2 ; follow-up: avcascade12 months ago

  • Cc avcascade@… added

Replying to johnbillion:

I toyed with the idea of removing the post format icons that are shown next to posts on the post listing screen too, but decided they should not be affected by this filter. They're easy enough to hide with CSS anyway.

Really appreciate your work on this, but wouldn't it make more sense to have a checkbox on the Settings > Writing screen that a user can check to completely disable Post Formats? And then gray out the selector for the default post format if the Disable Post Formats box is checked?

comment:17 in reply to: ↑ 16 SergeyBiryukov12 months ago

Replying to avcascade:

Really appreciate your work on this, but wouldn't it make more sense to have a checkbox on the Settings > Writing screen that a user can check to completely disable Post Formats?

The screen option for users is going to be added in #23930.

The filter in this ticket is a site-wide setting for developers.

comment:18 in reply to: ↑ 10 SergeyBiryukov12 months ago

Replying to batmoo:

it would be nice to continue to maintain support for selective post formats as was possible before (e.g. I only want my theme/site to use the gallery post format) as well as just completely disabling it.

Related: #24059

comment:19 dway11 months ago

  • Cc nicolasderambure@… added

Is this filter going to be in 3.6 final ?

Last edited 11 months ago by dway (previous) (diff)

comment:20 DrewAPicture11 months ago

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

See in [23946] and [24063].

Also:
#24059 proposes making the format list filterable
#24378 prososes a filter to hide post format icons in the list table

comment:21 dway11 months ago

the #24059 seems to be the more straightforward solution.

Note: See TracTickets for help on using tickets.