Skip to content

Instantly share code, notes, and snippets.

@certainlyakey
Created March 16, 2018 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save certainlyakey/1624210a41d7e77fb0b8f2e95fc5ef2e to your computer and use it in GitHub Desktop.
Save certainlyakey/1624210a41d7e77fb0b8f2e95fc5ef2e to your computer and use it in GitHub Desktop.
Add a hint on the media upload screen in admin (Wordpress)
<?php
function upload_hint() {
global $common_config;
$adminscreen = get_current_screen();
echo '<p>';
_e('Consider uploading images of at least 1050 pixels in width.','site');
echo '</p>';
// when featured images serve as logos
if ($adminscreen->id === 'post-type' && current_user_can('edit_users')) {
echo '<p>';
_e('It is recommended to upload the logo in SVG format for better quality.','site');
echo '</p>';
}
if (!current_user_can('edit_users')) {
echo '<p>';
echo $common_config->svg_role_error_label;
echo '</p>';
}
}
add_action( 'post-upload-ui', 'upload_hint' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment