中找到的一段代码的修改版本this tutorial.
add_filter(\'media_row_actions\', \'wpse_30159_qe_download_link\', 10, 2);
function wpse_30159_qe_download_link($actions, $post) {
/* Almost sure this is not necessary. Just in case... */
global $current_screen;
if ( \'upload\' != $current_screen->id )
return $actions;
// if not PDF file, return default $actions
if ( \'application/pdf\' != $post->post_mime_type )
return $actions;
// relative path/name of the file
$the_file = str_replace(WP_CONTENT_URL, \'.\', $post->guid);
// adding the Action to the Quick Edit row
$actions[\'Download\'] = \'<a href="\'.WP_CONTENT_URL.\'/download.php?file=\'.$the_file.\'">Download</a>\';
return $actions;
}
下载脚本位于此处:
/wp-content/download.php
.
和
here\'s 强制下载脚本的示例代码。