WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#33616 closed enhancement (fixed)

Add 'insertIntoPost' and 'uploadedToThisPost' to post type labels

Reported by: flixos90 Owned by: SergeyBiryukov
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.0
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:
PR Number:

Description

I noticed that among the media strings in wp_enqueue_media(), there are two strings which should be part of the post type labels which are provided/generated when registering a post type.

In particular, I'm talking about the strings for inserting media into a post/page(insertIntoPost) as well as for showing media uploaded to a post/page (uploadedToThisPost).

The wp_enqueue_media() function already receives the featured image labels from the current post type object, so I think it would be consistent to add the above two strings to the post type object as well and receive them from there, and we could get rid of the check whether that post type is hierarchical. This furthermore ensures that developers don't need to use a filter any more if they want to change these labels.

When adding the labels to the post type object, I would change the names a bit though, to reflect the other labels' structure, for example call them insert_into_item and uploaded_to_this_item respectively.

Attachments (2)

33616.diff (2.3 KB) - added by flixos90 4 years ago.
Patch with the minor changes implemented
33616.2.diff (2.9 KB) - added by flixos90 4 years ago.
include updated PHPDoc

Download all attachments as: .zip

Change History (5)

@flixos90
4 years ago

Patch with the minor changes implemented

@flixos90
4 years ago

include updated PHPDoc

#1 @flixos90
4 years ago

  • Keywords dev-feedback added

#2 @wonderboymusic
4 years ago

  • Keywords has-patch added; dev-feedback removed
  • Milestone changed from Awaiting Review to 4.4
  • Owner set to SergeyBiryukov
  • Status changed from new to assigned

We can look at this.

#3 @wonderboymusic
4 years ago

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

In 34472:

Media Modal: move the translation strings for insertIntoPost and uploadedToThisPost to the get_post_type_labels() array as insert_into_item and uploaded_to_this_item.

Props flixos90.
Fixes #33616.

Note: See TracTickets for help on using tickets.