[wp-trac] [WordPress Trac] #49178: Upload image issue after deleting image from edit image page
WordPress Trac
noreply at wordpress.org
Wed Jan 18 22:11:51 UTC 2023
#49178: Upload image issue after deleting image from edit image page
------------------------------+------------------------
Reporter: rnitinb | Owner: joedolson
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 6.2
Component: Media | Version: 5.3.2
Severity: normal | Resolution:
Keywords: has-patch commit | Focuses:
------------------------------+------------------------
Comment (by joedolson):
One possibility for some code simplification here:
{{{
+ if ( 1 === $detached ) {
+ $message = __( 'Media file detached.' );
+ } else {
+ /* translators: %s: Number of media files. */
+ $message = _n( '%s media file detached.', '%s media files
detached.', $detached );
+ }
}}}
Each check includes an if/else structure gives a different message
depending on whether the result is singular or plural. The value of
`$detached` (in this example) is an absint, so it's always going to be a
non-negative integer; so the singular return value of `_n()` here would
never be used. I can't see any reason these couldn't be collapsed to
remove the if/else.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49178#comment:29>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list