WP Manifestindependent plugin directory
manifest / media / wp-s3-media

WP S3 Media

Offload WordPress media uploads to Amazon S3 and serve files directly from S3.

by Gopi C · github.com/imgopi2002/wp-s3-media

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/imgopi2002/wp-s3-media/archive/refs/heads/main.zip

Offload WordPress media uploads to Amazon S3 and serve files directly from S3.


🚀 Overview

WP S3 Media automatically uploads media files to Amazon S3 when they are added to your WordPress Media Library.

After upload:

  • Files are stored in your configured S3 bucket
  • Media URLs are replaced with S3 URLs site-wide
  • Local files can optionally be removed to save server space

Ideal for:

  • High-traffic websites
  • Scalable cloud storage setups
  • Reducing server disk usage
  • CDN integrations (CloudFront supported via filters)

✨ Features

  • Automatic media offloading to Amazon S3
  • Dynamic attachment URL replacement
  • Optional local file deletion
  • Lightweight and performance-focused
  • Developer-friendly filters
  • WordPress 6+ compatible
  • PHPCS compliant codebase

📦 Requirements

  • WordPress 6.0+
  • PHP 7.4+
  • AWS S3 Bucket
  • AWS Access & Secret Keys

🔧 Installation

  1. Download or clone this repository.

  2. Upload the plugin folder to:

    /wp-content/plugins/wp-s3-media/
  3. Activate the plugin from WordPress Admin → Plugins.

  4. Go to:

    Settings → WP S3 Media
  5. Enter:

    • AWS Access Key
    • AWS Secret Key
    • Bucket Name
    • Region
  6. Save settings.

New uploads will now automatically be offloaded to S3.


🔁 How It Works

  1. User uploads media.
  2. File is sent to Amazon S3.
  3. Local file is optionally removed.
  4. Attachment URL is filtered and replaced with S3 URL.

🧩 Hooks & Filters

wp_s3_media_public_url

Filter the final public URL before it is returned.

add_filter( 'wp_s3_media_public_url', function ( $url, $post_id ) {
    return $url;
}, 10, 2 );

Example use cases:

  • Replace with CloudFront URL
  • Generate signed URLs
  • Add CDN query parameters

🛠 Developer Notes

  • Built using structured OOP architecture
  • Compatible with WordPress coding standards
  • Clean separation of:
    • S3 client handling
    • Settings management
    • Media handler logic

📌 Roadmap

  • Bulk migrate existing media
  • CloudFront integration helper
  • Signed URL support
  • Background processing for large uploads

📜 Changelog

1.0.0

  • Production-ready release
  • Automatic S3 offloading
  • Attachment URL filtering
  • Settings page added
  • PHPCS compliant structure

0.1.0

  • Initial development version

📄 License

This plugin is licensed under the GPLv2 or later.


👤 Author

Gopi C
Web Developer | WordPress | WooCommerce | Laravel | CodeIgniter | React | Tailwind CSS | JavaScript (ES6+) Linkeding url : https://www.linkedin.com/in/gopi-c-14847a254?utm_source=share&utm_campaign=share_via&utm_content=profile&utm_medium=android_app