WP Media Folder Developer Documentation
This documentation will help experienced developers to plug any other service with our plugin. Here are all actions and filters for this plugin, if you need some more, feel free to ask by using this for dedicated forum. Thanks for using our plugin!
Helper file
WP Media Folder comes with a helper file with the main functions you may need to integrate it in your own themes and plugins.
- Move a file into a folder
- Create folders
- Move folders
- Get attachments in a folder
- ...
include('wp-content/plugins/wp-media-folder/helper.php');
\Joomunited\WPMediaFolder\Helper::createFolder('My new folder');
Hooks
import_term_meta
Fires after term meta is imported.
Parameters :
int $term_id ID of the newly created term.
string $key Meta key.
mixed $value Meta value.
Return :
void
In files :
class/import/class-wp-import.php line 451
wpmf_after_replace
Do action after replace file
Parameters :
integer Attachment ID
Return :
void
In files :
class/class-replace-file.php line 188
wpmf_attachment_set_folder
Set attachment folder after moving an attachment to a folder in the media manager
This hook is also used when importing attachment to categories, after an attachment upload and
when assigning multiple folder to an attachment
Parameters :
integer Attachment ID
integer|array Target folder or array of target folders
array Extra informations
Return :
void
In files :
class/class-wp-folder-option.php line 377
class/class-wp-folder-option.php line 3233
class/class-main.php line 763
class/class-main.php line 794
class/class-main.php line 2332
class/class-main.php line 2885
class/class-main.php line 4020
class/class-main.php line 4819
class/class-helper.php line 138
class/class-helper.php line 194
wpmf_before_delete_folder
Before delete a folder
Parameters :
WP_Term Folder, this term is not available anymore as it as been deleted
Return :
void
In files :
class/class-main.php line 3550
class/class-main.php line 3921
wpmf_create_folder
Create a folder from media library
This hook is also used when syncing and importing files from FTP, creating user and role based folders
and importing from Nextgen Gallery
Parameters :
integer Created folder ID
string Created folder name
integer Parent folder ID
array Extra informations
Return :
void
In files :
class/class-wp-folder-option.php line 3110
class/class-main.php line 2309
class/class-main.php line 3377
wpmf_delete_folder
Delete a folder
Parameters :
WP_Term Folder, this term is not available anymore as it as been deleted
Return :
void
In files :
class/class-main.php line 3557
class/class-main.php line 3930
wpmf_duplicate_attachment
Duplicate an attachment
Parameters :
integer Attachment ID
integer Target folder
Return :
void
In files :
class/class-duplicate-file.php line 104
wpmf_move_folder
Move a folder from media library
This hook is also used when role folder option is changed
Parameters :
integer Folder moved ID
string Destination folder ID
array Extra informations
Return :
void
In files :
class/class-wp-folder-option.php line 2669
class/class-main.php line 4115
wpmf_update_folder_name
Update folder name
Parameters :
integer Folder ID
string Updated name
Return :
void
In files :
class/class-main.php line 3491
fallback_intermediate_image_sizes
Filters the image sizes generated for non-image mime types.
Parameters :
array $fallback_sizes An array of image size names.
array $metadata Current attachment metadata.
Return :
void
In files :
class/class-helper.php line 259
import_term_meta_key
Filters the meta key for an imported piece of term meta.
Parameters :
string $meta_key Meta key.
int $term_id ID of the newly created term.
array $term Term data from the WXR import.
Return :
void
In files :
class/import/class-wp-import.php line 432
the_content_export
Filters the post content used for WXR exports.
Parameters :
string $post_content Content of the current post.
Return :
void
In files :
class/class-wp-folder-option.php line 1293
the_excerpt_export
Filters the post excerpt used for WXR exports.
Parameters :
string $post_excerpt Excerpt for the current post.
Return :
void
In files :
class/class-wp-folder-option.php line 1302
wp_import_existing_post
Filter ID of the existing post corresponding to post currently importing.
Return 0 to force the post to be imported. Filter the ID to be something else
to override which existing post is mapped to the imported post.
Parameters :
int $post_exists Post ID, or 0 if post did not exist.
array $post The post array to be inserted.
Return :
void
In files :
class/import/class-wp-import.php line 505
wp_import_term_meta
Filters the metadata attached to an imported term.
Parameters :
array $termmeta Array of term meta.
int $term_id ID of the newly created term.
array $term Term data from the WXR import.
Return :
void
In files :
class/import/class-wp-import.php line 416
wpmf_gallery_enable_download
Filter to enable/disable download image on gallery
Parameters :
boolean Enable/disable download image
Return :
boolean
In files :
class/class-display-gallery.php line 459
wpmf_get_categories_args
Filter to custom aguments for get all categories
Parameters :
array Agument
Return :
array
In files :
class/class-main.php line 1898
wpmf_limit_folders
Filter to set limit of the folder number loaded
Parameters :
integer Limit folder number
Return :
integer
In files :
class/class-main.php line 1403
wpmf_set_file_title
Manipulate file title before saving it into database
Parameters :
string File title
Return :
string
In files :
class/class-main.php line 4940
wpmf_taxonomy_public
Filter to change public param wpmf-category taxonomy
Parameters :
boolean Toxonomy public status
Return :
boolean
In files :
wp-media-folder.php line 1484
wpmf_user_can
Filter check user capability to do an action
Parameters :
boolean The current user has the given capability
string Action name
Return :
boolean
In files :
wp-media-folder.php line 36
class/class-duplicate-file.php line 53
class/class-folder-access.php line 41
class/class-image-watermark.php line 209
class/class-wp-folder-option.php line 261
class/class-wp-folder-option.php line 766
class/class-wp-folder-option.php line 970
class/class-wp-folder-option.php line 1021
class/class-wp-folder-option.php line 1372
class/class-wp-folder-option.php line 1454
class/class-wp-folder-option.php line 2068
class/class-wp-folder-option.php line 3078
class/class-wp-folder-option.php line 3781
class/class-wp-folder-option.php line 3881
class/class-wp-folder-option.php line 3949
class/class-wp-folder-option.php line 4062
class/class-wp-folder-option.php line 4113
class/class-wp-folder-option.php line 4161
class/pages/settings/import_export.php line 151
class/pages/settings/import_export.php line 324
class/pages/settings/image_compression.php line 44
class/pages/settings/image_compression.php line 98
class/pages/settings/image_compression.php line 252
class/pages/settings/image_compression.php line 288
class/class-main.php line 954
class/class-main.php line 1218
class/class-main.php line 1256
class/class-main.php line 1417
class/class-main.php line 2186
class/class-main.php line 2220
class/class-main.php line 3016
class/class-main.php line 3341
class/class-main.php line 3438
class/class-main.php line 3803
class/class-main.php line 3855
class/class-main.php line 3968
class/class-main.php line 4061
class/class-main.php line 4151
class/class-main.php line 4433
class/class-main.php line 4566
class/class-main.php line 4757
class/class-main.php line 5219
class/class-main.php line 5266
class/install-wizard/install-wizard.php line 54
class/class-replace-file.php line 45
class/class-replace-file.php line 220
Composer
Set Update key programmatically with WP CLI
Use the same key you used for the composer installation and execute this composer command to set the update token
wp option update ju_user_token "YOUR_TOKEN"