Getting started

Integration & migration

Image & video API

DAM user guide

API overview

Account

ImageKit WordPress Plugin

Integrate ImageKit with your WordPress website using the official plugin for automatic image & video optimization, CDN delivery, and asset management.

•

Integrate ImageKit into your WordPress website using our official WordPress plugin. The plugin automatically optimizes and delivers your images, videos, and static assets through ImageKit's CDN, improving your site's performance without requiring code changes.

With the Enhanced Media Library integration, you can browse, search, and insert assets from your ImageKit Media Library directly within WordPress - in both the classic media modal and the Gutenberg block editor. This eliminates the need to switch between WordPress and ImageKit when working with your media assets.

The plugin source code is available on GitHub.

Plugin capabilities

Feature Available
Image optimization and deliveryYes
Automatic format conversion (WebP, AVIF), quality optimization, and metadata removal. All images delivered through ImageKit CDN without modifying originals.
Video optimization and deliveryYes
Automatic video optimization for faster playback. Apply global transformations like resize, crop, and format conversion using ImageKit URL-based transformations.
Static asset deliveryYes
Deliver theme, plugin, and WordPress core CSS & JS files via ImageKit CDN with granular per-category toggles.
Responsive imagesYes
Automatically generate responsive image breakpoints with configurable settings for optimal delivery across devices.
Media offloadingYes
Upload new media library files to ImageKit with flexible storage options - keep originals locally, store low-resolution copies, or offload entirely.
Enhanced Media Library integrationYes
Browse, search, and insert ImageKit assets directly from WordPress media modal and Gutenberg block editor.
Lazy loadingWordPress native
WordPress 5.5+ includes native lazy loading for images.

Integration steps

Here is what you need to do:

Step 1: Install and activate the ImageKit plugin

Install and activate the ImageKit WordPress plugin from the WordPress plugin directory. After activation, the plugin launches a setup wizard that walks you through configuring your credentials and delivery preferences.

Step 2: Setup credentials

Enter your ImageKit credentials from the Developer section of your ImageKit dashboard. You'll need to provide your URL endpoint (e.g., https://ik.imagekit.io/your_imagekit_id), public key, and private key.

The wizard also guides you through configuring your WordPress site as a web server origin in ImageKit, with your site URL as the base URL. If you have a different setup, such as an Amazon S3 bucket, configure the appropriate origin in the external storage section of your ImageKit dashboard.

The URL endpoint is required for asset delivery (URL rewriting). The public key and private key are additionally needed for media uploads, the Enhanced Media Library, and usage statistics.

You can verify that asset delivery is working by fetching an asset through your ImageKit URL endpoint. When you add the first origin in your account, it automatically becomes accessible through the default URL endpoint, that is https://ik.imagekit.io/your_imagekit_id. Otherwise, you will have to configure an existing URL endpoint or create a new one to fetch assets from this newly added origin.

If your old asset URL was https://www.example.com/wp-content/uploads/image.jpg, then the same asset should be accessible through your ImageKit URL endpoint:

https://ik.imagekit.io/your_imagekit_id/wp-content/uploads/image.jpg

Step 3: Delivery toggles

Choose what you'd like to deliver through ImageKit. All options are enabled by default and can be changed later in the plugin settings. You can enable delivery for Images (optimized via ImageKit CDN with automatic format conversion), Videos (for faster playback), and Assets (theme, plugin, and WordPress core CSS & JS files).

After completing the wizard, your WordPress media and assets will be delivered through ImageKit. You can further configure the plugin using the settings pages described below.

Enhanced Media Library

Access your ImageKit Media Library directly from WordPress. This feature integrates seamlessly with both the classic media modal and the Gutenberg block editor.

To use the Enhanced Media Library:

  1. Open the WordPress media modal (when adding an image to a post or page)
  2. Click Open Media Library button to browse your ImageKit assets
  3. Search, filter, and select assets from your ImageKit account
  4. Insert selected assets directly into your content

This integration requires your public key and private key to be configured in the plugin settings.

Plugin settings

After setup, navigate to ImageKit in the WordPress admin sidebar to access the plugin settings. The settings are organized across multiple pages:

General settings

The General settings page shows your connection status, configured credentials, media library upload settings, and current usage summary.

Connection status

Displays your current ImageKit connection state and configured credentials (URL endpoint, public key, private key). From here you can Reconfigure to re-run the setup wizard and update credentials, or Disconnect to remove the ImageKit connection.

Media library upload settings

Configure how new media library uploads are handled. The ImageKit folder path specifies the folder in your ImageKit account where WordPress assets are uploaded to (leave blank to use the root). The Storage option lets you choose where your assets are stored:

Mode Description
ImageKit and WordPressStores assets in both locations. Enables local WordPress delivery if the plugin is disabled or uninstalled.
ImageKit and WordPress (low resolution)Stores original assets in ImageKit and low-resolution versions in WordPress. Enables low-resolution local fallback delivery.
ImageKit onlyStores assets in ImageKit only. Requires additional steps to enable backwards compatibility if the plugin is removed.
WordPress onlyStores assets in WordPress only and disables uploading new assets to ImageKit.

Current usage summary

The sidebar displays your current ImageKit account usage, including Media Library Storage, Original Cache Storage, Bandwidth, Video Processing Units, and Extensions Units. Click Go to ImageKit Dashboard for detailed analytics.

Image settings

Control how images are delivered through ImageKit.

Toggle Image delivery to enable or disable delivering images from ImageKit (when disabled, images are served from WordPress). Global image transformations lets you apply a set of ImageKit URL-based transformations to all images using ImageKit transformation syntax, e.g., q-80,f-webp for 80% quality in WebP format.

Video settings

Control how videos are delivered through ImageKit.

Toggle Video delivery to enable or disable delivering videos from ImageKit (when disabled, videos are served from WordPress). Global video transformations lets you apply a set of ImageKit video transformations to all videos using ImageKit transformation syntax, e.g., h-400,w-400.

Asset settings

Control which static assets (CSS and JavaScript files) are delivered through ImageKit CDN.

The plugin provides six granular toggles organized by source: Theme CSS, Theme JS, Plugin CSS, Plugin JS, WordPress Core CSS, and WordPress Core JS. Each toggle controls whether that category of static files is delivered through ImageKit CDN.

Excluding specific assets

To exclude specific assets from being rewritten to ImageKit URLs, use the WordPress filter hooks imagekit_exclude_url (for media URLs) or imagekit_exclude_asset_url (for CSS/JS asset URLs).

Example:

Copy
// Exclude a specific CSS file from ImageKit delivery.
add_filter( 'imagekit_exclude_asset_url', function( $exclude, $url, $handle, $type ) {
    if ( 'my-plugin-style' === $handle ) {
        return true;
    }
    return $exclude;
}, 10, 4 );

Responsive images

Serve perfectly sized images to every device, reducing bandwidth usage and improving page load speeds. This feature automatically generates custom srcset breakpoints, allowing browsers to download only the image size they need - smaller images for mobile devices, larger ones for desktop.

Toggle Enable responsive image breakpoints to automatically generate responsive srcset breakpoints for your images. When enabled, you can customize:

  • Breakpoint distance - Minimum pixel difference between breakpoints (default: 150px)
  • Maximum images - Maximum number of breakpoint images to generate (default: 15)
  • Minimum image width - Smallest breakpoint width (default: 32px)
  • Maximum image width - Largest breakpoint width (default: 3840px)

Troubleshooting

If you encounter issues, a detailed system report is available on the Get Help page in the plugin settings. The report includes your WordPress environment details, active theme, plugins, ImageKit plugin configuration, and PHP settings. You can copy or download the report to share with ImageKit support.

Best practices

  1. Always back up your site before installing the plugin or making significant configuration changes.
  2. Start with images and videos - enable these first for immediate performance gains.
  3. Test asset delivery gradually - enable CSS and JS delivery one category at a time to ensure compatibility.
  4. Monitor your usage - check the usage summary in General settings regularly to track bandwidth and storage.
  5. Configure API keys - provide public and private keys to unlock all features including media uploads and Enhanced Media Library.