Skip to content

Cache Not Cleared in wp_mcloud_post_map When Deleting Files #243

Description

@BoatsDawn

Describe the Bug

When the Cache Attachment Lookups setting is enabled, deleting a file does not remove its cache entry from the wp_mcloud_post_map table. This leads to issues when re-uploading a file with the same name, as the cache still points to the old file instead of the new one.

Steps to Reproduce

  1. Upload a file named test.zip.
  2. Delete the file test.zip.
  3. Re-upload a file with the same name, test.zip.
  4. Use attachment_url_to_postid($url) to check the association — it still points to the file from step 1.

Expected Behavior

When a file is deleted, its corresponding entry in the wp_mcloud_post_map table should also be deleted to prevent stale cache data.

Server Details

  • Operating System: Ubuntu (Docker)
  • PHP Version: 8.2
  • Web Server: Apache (from the WordPress Docker image)

Plugin Installation

Installed via the WordPress admin panel using the plugin store.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions