Skip to content

Commit ed0a5bd

Browse files
committed
Add reference for MediaManager class.
1 parent 9cad79e commit ed0a5bd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/reference.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,18 @@ This enables seamless AI-driven interactions with the WordPress REST API.
207207
| `MapRESTtoMCP::generate_description( $info )` | `string` | Creates human-readable descriptions for API routes. |
208208
| `MapRESTtoMCP::rest_callable( $inputs, $route, $method_name, $server )` | `array` | Executes a REST API call dynamically. |
209209

210+
## `MediaManager` class
211+
212+
The `MediaManager` class provides a static method to upload a media file to the WordPress Media Library. It:
213+
214+
- Copies a file into the WordPress uploads directory.
215+
- Registers the file as a WordPress media attachment.
216+
- Generates and updates attachment metadata.
217+
218+
This class is useful for automated media uploads within WP-CLI or AI-powered workflows.
219+
220+
### Methods
221+
222+
| Name | Return Type | Description |
223+
| --- | --- | --- |
224+
| `MediaManager::upload_to_media_library( $media_path )` | `int` | Uploads a media file to WordPress and returns its attachment ID. |

0 commit comments

Comments
 (0)