Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function enable_media_replace( $form_fields, $post ) {
- $current_screen = get_current_screen();
- if ( $current_screen->base == 'post' && $current_screen->post_type == 'attachment' ) {
- $url = admin_url( "upload.php?page=enable-media-replace/enable-media-replace.php&action=media_replace&attachment_id=" . $post->ID);
- $action = "media_replace";
- $editurl = wp_nonce_url( $url, $action );
- if (FORCE_SSL_ADMIN) {
- $editurl = str_replace("http:", "https:", $editurl);
- }
- $link = "href=\"$editurl\"";
- $form_fields["enable-media-replace"] = array("label" => __("Replace media", "enable-media-replace"), "input" => "html", "html" => "<p><a class='button-secondary'$link>" . __("Upload a new file", "enable-media-replace") . "</a></p>", "helps" => __("To replace the current file, click the link and upload a replacement.", "enable-media-replace"));
- }
- return $form_fields;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement