Using WordPress ‘post-plupload-upload-ui’ PHP action

The post-plupload-upload-ui WordPress PHP action fires after the upload interface loads.

Usage

add_action('post-plupload-upload-ui', 'your_custom_function');
function your_custom_function() {
  // your custom code here
}

Parameters

  • None

More information

See WordPress Developer Resources: post-plupload-upload-ui

Examples

Display a custom message after the upload interface loads

add_action('post-plupload-upload-ui', 'display_custom_message');
function display_custom_message() {
  echo '<p><strong>Note:</strong> Please ensure that your files are not larger than 2MB.</p>';
}

Show a warning if uploading a certain file type

add_action('post-plupload-upload-ui', 'display_file_type_warning');
function display_file_type_warning() {
  echo '<p><strong>Warning:</strong> Uploading PDF files is not recommended.</p>';
}

Display a message with upload guidelines

add_action('post-plupload-upload-ui', 'display_upload_guidelines');
function display_upload_guidelines() {
  echo '<p><strong>Upload Guidelines:</strong> Please use descriptive file names and avoid using special characters.</p>';
}

Show a message for users to compress their images before uploading

add_action('post-plupload-upload-ui', 'display_image_compression_message');
function display_image_compression_message() {
  echo '<p><strong>Tip:</strong> Compress your images before uploading to improve page load times.</p>';
}

Display a message about supported file formats

add_action('post-plupload-upload-ui', 'display_supported_formats_message');
function display_supported_formats_message() {
  echo '<p><strong>Supported Formats:</strong> JPEG, PNG, GIF, and BMP.</p>';
}