Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#49314 closed defect (bug) (duplicate)

WordPress Adding "-1" to Uploaded Images

Reported by: webmastert's profile WebmasterT Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.3.2
Component: Media Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

This problem occurs even when I deactivate all plugins and use the default theme.

It began on December 13, 2019.

When adding an image into the WordPress data that is labeled:

this-picture-upload-01-700x400

Wordpress has begun adding a -1 after the file name, creating:

this-picture-upload-01-700x400-1

This "-1" is typically added only when the exact same file name already exists in in the database.

Now WordPress is adding it to any upload like this:

this-picture-upload-01-700x400

If I add a picture with a file name like this (I actually added this into the database for you to see):

drfdffdfsddfdfdfdf38

Wordpress doesn't add "-1"

But when I change that same file to this file name (I actually added this into the database for you to see):

qorianka-kilcher-the-new-world-01-1896x812

Wordpress does this to the file name:

qorianka-kilcher-the-new-world-01-1896x812-1

Again, no other previous upload for "qorianka-kilcher-the-new-world-01-1896x812' exists in our system.

........

I showed this problem to my website host, and this was their reply:

I have set up a brand new fresh installation of WordPress on my personal account. There are no plugins or themes. The installation was performed specifically to test this on a fresh install.

=================
[0159][root@sip1-228 /home/ehegelne/wp.ehegel.net/html]$ find . |grep -i jelly
./wp-content/uploads/2020/01/Jellyfish-01-2020-1024x768-1-300x225.jpg
./wp-content/uploads/2020/01/Jellyfish-01-2020-1024x768-1-150x150.jpg
./wp-content/uploads/2020/01/Jellyfish-01-2020-1024x768-1.jpg
./wp-content/uploads/2020/01/Jellyfish-01-2020-1024x768-1-768x576.jpg
=================

=================
[0200][root@sip1-228 /home/ehegelne/wp.ehegel.net/html]$ find . |grep -i koala
./wp-content/uploads/2020/01/Koala.jpg
./wp-content/uploads/2020/01/Koala-150x150.jpg
./wp-content/uploads/2020/01/Koala-768x576.jpg
./wp-content/uploads/2020/01/Koala-300x225.jpg
=================

As you can see the same behavior occurs. I am not sure why Wordpress does this, but it is default behavior of the application.

.................

Can this error be fixed please so that when a person adds a non-duplicate file like this-picture-upload-01-700x400, a "-1" is not added to it?

Thank you.

Change History (1)

#1 @SergeyBiryukov
5 years ago

  • Description modified (diff)
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi there, welcome to WordPress Trac! Thanks for the ticket.

That behavior is indeed new in WP 5.3.1, introduced in [46822] / #42437.

You can read more about the reasons behind the change in tickets #48974 and #42437, specifically these comments:

Hope this helps. Since it's the same issue as reported in #48974, the discussion can continue there if necessary.

Note: See TracTickets for help on using tickets.