Advertisement
Guest User

Update to Enable Media Replace

a guest
Dec 12th, 2012
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.89 KB | None | 0 0
  1. function enable_media_replace( $form_fields, $post ) {
  2.     $current_screen = get_current_screen();
  3.     if ( $current_screen->base == 'post' && $current_screen->post_type == 'attachment' ) {
  4.  
  5.         $url = admin_url( "upload.php?page=enable-media-replace/enable-media-replace.php&action=media_replace&attachment_id=" . $post->ID);
  6.         $action = "media_replace";
  7.         $editurl = wp_nonce_url( $url, $action );
  8.  
  9.         if (FORCE_SSL_ADMIN) {
  10.             $editurl = str_replace("http:", "https:", $editurl);
  11.         }
  12.         $link = "href=\"$editurl\"";
  13.         $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"));
  14.     }
  15.     return $form_fields;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement