-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathmedia.php
More file actions
63 lines (52 loc) · 1.8 KB
/
Copy pathmedia.php
File metadata and controls
63 lines (52 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/**
* Set file types allowed to be uploaded
*
* @link https://developer.wordpress.org/reference/hooks/upload_mimes/
*/
add_filter(
'upload_mimes',
function ( $mime_types ) {
$mime_types = array(); // Remove all types
$mime_types['jpg|jpeg|jpe'] = 'image/jpeg'; // Only add jpg for example
return $mime_types;
}
);
/**
* Remove actions from Media Upload
* This will just remove the strings for the buttons, not disable their functionality completelly.
* @link https://developer.wordpress.org/reference/hooks/media_view_strings/
*/
add_filter(
'media_view_strings',
function ( $strings ) {
$strings['createGalleryTitle'] = null; // Remove "Create gallery"-button.
$strings['createPlaylistTitle'] = null; // Remove "Create Audio Playlist"-button.
$strings['createVideoPlaylistTitle'] = null; // Remove "Create Video Playlist"-button.
$strings['insertFromUrlTitle'] = null; // Remove "Insert from URL"-button.
$strings['setFeaturedImageTitle'] = null; // Remove "Featured Image"
return $strings;
}
);
/**
* Hide input fields when uploading or editing media
*/
add_action(
'admin_print_scripts',
function () {
?><style>
.attachment-details .setting[data-setting="alt"], /* Alt attribute */
.attachment-details #alt-text-description, /* and the description under it */
.attachment-details .setting[data-setting="caption"], /* Media caption */
.attachment-details .setting[data-setting="description"], /* Media description */
.attachment-details .setting[data-setting="title"], /* Media title */
.attachment-details .setting[data-setting="url"], /* Media url */
.attachment-details .setting[data-setting="artist"], /* Audio artist */
.attachment-details .setting[data-setting="album"] /* Audio album */
{
display: none;
}
</style>
<?php
}
);