You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Combine both the items to one standard XML, WXR format and try to import the file.
You would notice that, the media has been imported correctly, post have been imported correctly, but when you open post in edit mode, the media would look broken because, the extension to the media is not present, hence $this->url_remap, mapped the URLs without extension.
The above source code is creating the issue, because the source URL does not have any extension, hence anytime this array uses the key, it replaces the old value to new value, and new value as per the given link is removing the file extension itself.
This is the only case with an external file without extension, So we should have a condition for checking if the source URL, wp_attachment_url does not contain extension, we should not run the above lines of code to make everything works as expected.
Here is the attached video, that would demonstrate the difference between external URL and WordPress specific URL media and post import with specific scenarios.
Issue
wp_attachment_urlwith an external URL without file extension.XML file format,
Add this item to the WXR file for the post, and use the image block with source as the link given.
Combine both the items to one standard XML, WXR format and try to import the file.
You would notice that, the media has been imported correctly, post have been imported correctly, but when you open post in edit mode, the media would look broken because, the extension to the media is not present, hence
$this->url_remap, mapped the URLs without extension.wordpress-importer/src/class-wp-import.php
Lines 1042 to 1048 in 2ed3a29
The above source code is creating the issue, because the source URL does not have any extension, hence anytime this array uses the key, it replaces the old value to new value, and new value as per the given link is removing the file extension itself.
This is the only case with an external file without extension, So we should have a condition for checking if the source URL, wp_attachment_url does not contain extension, we should not run the above lines of code to make everything works as expected.
Here is the attached video, that would demonstrate the difference between external URL and WordPress specific URL media and post import with specific scenarios.
MediaImportExternalIssue.mov