The post-html-upload-ui WordPress action fires after the upload button in the media upload interface.
Usage
add_action('post-html-upload-ui', 'your_custom_function'); function your_custom_function() { // your custom code here }
Parameters
- None
More information
See WordPress Developer Resources: post-html-upload-ui
Examples
Add a custom message after the upload button
Add a custom message to inform users about the accepted file types.
add_action('post-html-upload-ui', 'add_custom_message_after_upload_button'); function add_custom_message_after_upload_button() { // Add your message after the upload button echo '<p><strong>Accepted file types:</strong> jpg, png, gif, pdf, docx</p>'; }
Display a terms and conditions checkbox
Require users to accept terms and conditions before uploading media.
add_action('post-html-upload-ui', 'display_terms_conditions_checkbox'); function display_terms_conditions_checkbox() { // Display a checkbox for terms and conditions echo '<label><input type="checkbox" name="terms_conditions" required> I accept the terms and conditions</label>'; }
Add a custom notice for file size limitations
Inform users about the maximum file size allowed for uploads.
add_action('post-html-upload-ui', 'add_file_size_limit_notice'); function add_file_size_limit_notice() { // Add a notice for file size limit echo '<p><strong>Maximum file size:</strong> 5MB</p>'; }
Insert additional form fields
Add extra form fields for users to provide more information about the uploaded media.
add_action('post-html-upload-ui', 'add_additional_form_fields'); function add_additional_form_fields() { // Add extra form fields echo '<label for="media_description">Media Description:</label>'; echo '<input type="text" name="media_description" id="media_description" required>'; }
Add custom styling to the upload interface
Apply custom CSS styles to the media upload interface.
add_action('post-html-upload-ui', 'apply_custom_css_to_upload_interface'); function apply_custom_css_to_upload_interface() { // Apply custom CSS to the upload interface echo '<style> .upload-interface { background-color: #f9f9f9; padding: 20px; border-radius: 5px; } </style>'; }