WordPress.org

Make WordPress Core

Opened 6 years ago

Last modified 10 months ago

#14077 new enhancement

Add support for removal of multiple features from a post type in remove_post_type_support

Reported by: Utkarsh Owned by:
Milestone: Future Release Priority: normal
Severity: minor Version: 3.0
Component: Posts, Post Types Keywords: has-patch dev-feedback
Focuses: Cc:

Description

From this thread

add_post_type_support allows an array to be passed as the 2nd parameter, but remove_post_type_support doesn't.

The patch attached adds the functionality.

Attachments (10)

14077.diff (971 bytes) - added by Utkarsh 6 years ago.
14077_2.diff (975 bytes) - added by edwardw 5 years ago.
Update of Utkarsh's previous patch
14077.3.diff (1.0 KB) - added by jeremyfelt 4 years ago.
Refreshed patch
14077.4.diff (2.3 KB) - added by SergeyBiryukov 4 years ago.
Brings similar formatting cleanup to add_post_type_support() for consistency
remove-post-type-support-array.14077.diff (963 bytes) - added by wycks 3 years ago.
14077.5.diff (963 bytes) - added by wycks 3 years ago.
Fixed diff file name, not sure if it matters
14077.2.diff (1.1 KB) - added by paulwilde 14 months ago.
14077.6.diff (2.1 KB) - added by paulwilde 14 months ago.
Alternative patch which cleans up add_post_type_support() and changes $feature to $features
14077.7.diff (2.1 KB) - added by paulwilde 11 months ago.
14077.8.diff (2.5 KB) - added by paulwilde 11 months ago.

Download all attachments as: .zip

Change History (23)

@Utkarsh
6 years ago

#1 @Utkarsh
6 years ago

  • Cc admin@… added
  • Keywords needs-testing added; needs removed

#2 @nacin
6 years ago

  • Milestone changed from Unassigned to 3.1

#3 @nacin
6 years ago

  • Keywords needs-refresh added; needs-testing removed
  • Milestone changed from Awaiting Triage to Future Release

Patch doesn't adhere to coding standards. Needs whitespace, also, the cast should probably be within the foreach directly.

@edwardw
5 years ago

Update of Utkarsh's previous patch

#4 @edwardw
5 years ago

  • Keywords has-patch dev-feedback added; needs-refresh removed

Updated Utkarsh's previous patch to current SVN and formatted.

#5 @nacin
5 years ago

  • Component changed from General to Post Types
  • Keywords dev-feedback removed
  • Type changed from defect (bug) to enhancement

#6 @DrewAPicture
4 years ago

Closed #21224 as duplicate. Would be nice to get some traction on this in 3.5.

@jeremyfelt
4 years ago

Refreshed patch

#7 @jeremyfelt
4 years ago

Refreshed previous patch with additional code formatting in 14077.3.diff.

Tested remove_post_type_support() with both a single string and an array of features and works.

@SergeyBiryukov
4 years ago

Brings similar formatting cleanup to add_post_type_support() for consistency

#8 @wycks
3 years ago

  • Cc bob.ellison@… added

Patch update for 3.6, seems add_post_type_support got an array but remove_post_type_support didn't.

Can test with:

function init_remove_support(){
	$post_type = 'post';
	remove_post_type_support( $post_type, array('editor',  'title', 'thumbnail'));
}

@wycks
3 years ago

Fixed diff file name, not sure if it matters

@paulwilde
14 months ago

#9 @paulwilde
14 months ago

  • Keywords dev-feedback added

Was about to create a new ticket with a patch until I found this one.

I've attached a patch that fixes this in trunk.

@paulwilde
14 months ago

Alternative patch which cleans up add_post_type_support() and changes $feature to $features

@paulwilde
11 months ago

#10 @paulwilde
11 months ago

Refreshed patch.

This would be a nice easy win for 4.4.

#11 @DrewAPicture
11 months ago

  • Keywords needs-docs added

Both function changes would warrant adding a changelog entry to the @since block in the DocBlocks. Something along the lines of

@since 4.4.0 The `$feature` parameter was renamed to `$features` and changed to also accept an array of features.

Note the backticks in the description (this is for formatting purposes in the code reference after being parsed.

@paulwilde
11 months ago

#12 @paulwilde
11 months ago

  • Keywords needs-docs removed

Added changelog entries as suggested by @DrewAPicture. Also refreshed patch to apply on trunk (post.php was rearranged into post-functions.php).

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

#13 @paulwilde
10 months ago

Patch still applies cleanly - Any interest in this going into 4.4?

Note: See TracTickets for help on using tickets.