Functions
The Function section provides a collection of PHP functions designed to manage folders and attachments within the WordPress Media Library. These functions utilize a structured namespace for easy integration and usage within custom plugins or themes.
Key Features:
✅ Simplified Folder Management – Create, retrieve, and organize folders effortlessly. ✅ Attachment Handling – Easily assign or remove media files from folders. ✅ Optimized for Developers – Functions are namespaced for better organization and seamless integration. ✅ Flexible Usage – Designed for use in custom development, ensuring compatibility with WordPress best practices.
Available Functions:
🔹 Get Folders – Retrieve detailed information about all folders. 🔹 Get Folder – Fetch data for a specific folder by ID. 🔹 Add Folder – Create a new folder within the media library. 🔹 Rename Folder – Rename folder by id. 🔹 Change Folder Color – Change folder color by id. 🔹 Remove Folder – Remove folder by id. 🔹 Add Attachment – Assign media files to a folder. 🔹 Remove Attachment – Detach media files from a folder.
Each function is well-documented, making it easy for developers to integrate and extend functionality based on project needs.
Source
\includes\Model\Folder.phpGet Folders
<?php
use Luvre\Model\Folder as MyFolder;
$folders = MyFolder::generateFoldersData();Get Folder
<?php
use Luvre\Model\Folder as MyFolder;
$folder_id = 1;
$folders = MyFolder::getFolderData( $folder_id );Add Folder
Rename Folder
Change Folder Color
Remove Folder
Source
Add Attachment
Remove Attachment
Last updated