Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds attachment rename & replace #903

Merged
merged 15 commits into from
Apr 7, 2025
Merged

feat: adds attachment rename & replace #903

merged 15 commits into from
Apr 7, 2025

Conversation

abaicus
Copy link
Contributor

@abaicus abaicus commented Mar 25, 2025

All Submissions:

Changes proposed in this Pull Request:

  • Adds rename / replace attachment fields in the single attachment edit view;
  • Automatically replaces DB links for the main URL and image sizes, including -scaled suffixed images;
  • DAM Imported & Offloaded images do not have this feature;
  • Attachment files can only be replaced with other files that have the same mime-type;
  • Automatically clears Elementor & Otter blocks cache and CSS files when a rename / replace is done;

Initial state:

image

Replacement filled:

image

Closes Codeinwp/optimole-service#1163.

How to test the changes in this Pull Request:

I suggest testing with multiple attachment file types that are supported by WordPress.

  1. Upload an attachment;
  2. Go to its' single edit page;
  3. You should see both the rename and replace field;
  4. These fields should work as expected;
  5. Names should automatically be sanitized to a valid version;
  6. When renaming or replacing an attachment, all of its links should be updated in the content;
    • This includes CSS generated files, customizer settings, post meta, etc;
  7. Offloaded attachments and dam-imported ones should not have these fields available;

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@abaicus abaicus marked this pull request as ready for review March 31, 2025 16:47
@pirate-bot
Copy link
Collaborator

pirate-bot commented Mar 31, 2025

Plugin build for 6077f05 is ready 🛎️!

@abaicus abaicus force-pushed the prf/media-rename branch 10 times, most recently from 28b4f72 to 42295a7 Compare March 31, 2025 19:20
@abaicus abaicus force-pushed the prf/media-rename branch from abb008b to 0c94b7b Compare April 1, 2025 09:42
@abaicus abaicus changed the title [wip] feat: adds attachment file rename feat: adds attachment rename & replace Apr 1, 2025
@abaicus abaicus requested a review from selul April 1, 2025 12:32
Copy link
Contributor

@selul selul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great 🍾

@selul selul merged commit 6d45201 into development Apr 7, 2025
11 checks passed
@selul selul deleted the prf/media-rename branch April 7, 2025 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants