PHP WordPress - Add Media Upload Button

<? add_action( 'pre-plupload-upload-ui', 'wpse_20160202_pre_plupload_upload_ui' ); add_action( 'post-upload-ui', 'wpse_20160202_post_upload_ui' ); function wpse_20160202_pre_plupload_upload_ui() { # see https://core.trac.wordpress.org/browser/tags/4.4.1/src/wp-admin/includes/media.php#L1902 print '<button onclick="javascript:alert(\'Upload From Dropbox\');" id="db-upload-btn" class="button media-button button-primary button-large" style="margin-bottom:10px;">Upload From Dropbox</button>'; } function wpse_20160202_post_upload_ui() { # see wp-includes/media-template.php print '<button onclick="javascript:alert(\'Another Upload From Dropbox\');" id="db-upload-btn" class="button media-button button-primary button-large" style="margin-bottom:10px;">Another Upload From Dropbox</button>'; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.