How to Create Folders in Your WordPress Media Library

  • January 19, 2026
  • Deepak Gupta
  • 5 min read

One of the coolest things about WordPress is that it works beautifully right out of the box—but at the same time, it can be extended to almost any functionality you need with plugins or a bit of custom code.

The WordPress Media Library is a perfect example of this.

Out of the box, WordPress stores all media files in one place. No folders. No structure. Just a growing list of images, PDFs, and videos. For small websites, this is fine—but once your site grows, managing media becomes painful.

As a WordPress Developer, WooCommerce Developer, MERN Stack Developer, and Full Stack Developer, Deepak Gupta frequently sees this issue on content-heavy blogs and WooCommerce stores.

So the obvious question is:

Can you create folders in the WordPress Media Library?
Out of the box — ❌ No
With a plugin or code — ✅ Absolutely

In this guide, I’ll show you how to create media library folders using a plugin, and then we’ll also look at how developers can create folders programmatically.


Creating Media Library Folders Using a Plugin

The easiest and safest way to add folders to the Media Library is by using a dedicated plugin. WordPress itself doesn’t support folders in the admin UI, so plugins handle this by creating virtual folders—your file URLs remain unchanged, which is critical for SEO and performance.

From a WooCommerce Developer perspective, this is especially important because broken image URLs can affect product pages and conversions.


Step 1: Install and Activate the Media Folder Plugin

First, you need to install the media library folders plugin.

Once you have the plugin file:

  1. Go to WordPress Admin → Plugins → Add New
  2. Click Upload Plugin
  3. Upload the plugin ZIP file
  4. Click Install Now
  5. Activate the plugin

Once you’ve done that, let’s activate it:

If you’re using WordPress Multisite, I recommend network-activating the plugin so media folders work consistently across the network.

This approach is commonly recommended by experienced Plugin Developers to avoid conflicts later.


Step 2: Create Folders in the WordPress Media Library

Once the plugin is activated, head over to:

Media → Library

By default, you’ll see something like:

  • All Files
  • Uncategorized

Now you’ll also see an “Add Folder” button.

Click it, give your folder a name, and you’re done.

You can now:

  • Select multiple media files
  • Drag and drop them into folders
  • Keep your uploads organized

This is a huge productivity boost for editors and store managers alike.


Creating a new folder with the help of the Simple Media Library Folders plugin.

Can You Create Subfolders in the Media Library?

Yes—subfolders are fully supported.

When creating a new folder, simply choose a parent folder in the folder creation modal. This allows you to build a clean hierarchy such as:

  • Products
    • Shoes
    • Jackets
  • Blog
    • Tutorials
    • Case Studies

As a Full Stack Developer, I strongly recommend using a clear folder structure from the start—it saves hours later.


Is it possible to create sub-folders in the WordPress media library? 

Definitely, it is!

If you followed the previous step carefully and created a bunch of folders, you can now see that you can select them in the “Add folder” modal window:

Select a parent folder when you want to create a subfolder.

Can You Create Media Folders Programmatically?

This depends on what you mean by “programmatically.”

Option 1: No Plugin (Advanced)

If you don’t care much about UI, a WordPress Developer can:

  • Register a custom taxonomy for attachments
  • Treat taxonomy terms as folders

This works, but requires custom admin UI work and is not beginner-friendly.


Option 2: Using Plugin API (Recommended for Developers)

Most professional media folder plugins expose a PHP API, which allows developers to create folders via code.

For example, creating a folder programmatically:

$folder_name = 'Greece';
smlf_create_folder( $folder_name );

This function should be run only once, such as during theme setup or plugin activation.


Creating Subfolders Programmatically

To create a parent folder and a child folder:

// Create parent folder
$parent_folder_id = smlf_create_folder( 'Greece' );

if( ! is_wp_error( $parent_folder_id ) ) {

	// Create child folder
	$child_folder_id = smlf_create_folder( 'Athens' );

	if( ! is_wp_error( $child_folder_id ) ) {

		// Assign parent folder
		smlf_update_folder(
			$child_folder_id,
			array(
				'parent' => $parent_folder_id,
			)
		);
	}
}

This is extremely useful for:

  • Travel blogs
  • WooCommerce product catalogs
  • Large editorial websites

Creating Multiple Folders at Once (Bulk Setup)

As a MERN Stack Developer working with large datasets, automation matters.

Simple Loop Example

$folder_names = array( 'Athens', 'Lisbon', 'Rome' );

foreach( $folder_names as $folder_name ) {
	smlf_create_folder( $folder_name );
}

Multi-Level Folder Structure

$folders = array(
	'Greece' => array( 'Athens', 'Santorini' ),
	'Portugal' => array( 'Lisbon', 'Porto' ),
);

foreach( $folders as $parent => $children ) {

	$parent_id = smlf_create_folder( $parent );

	if( is_wp_error( $parent_id ) ) {
		continue;
	}

	foreach( $children as $child ) {

		$child_id = smlf_create_folder( $child );

		if( is_wp_error( $child_id ) ) {
			continue;
		}

		smlf_update_folder( $child_id, array( 'parent' => $parent_id ) );
	}
}

This approach is commonly used by Plugin Developers when setting up structured media environments for clients.


Final Thoughts

WordPress doesn’t support media folders by default—but with the right plugin or developer approach, you can completely transform the Media Library experience.

Whether you’re a content creator, store owner, or agency, organized media means:

  • Faster workflows
  • Fewer mistakes
  • Cleaner site management

Built with the mindset of a WordPress Developer, extended like a Plugin Developer, and automated like a Full Stack Developer, media folders are one of those small improvements that deliver huge long-term value.

Leave a Reply

Your email address will not be published. Required fields are marked *