
parudou
更新日:2019/08/19
ワードプレスのメディア添付画面の「画像の意味を説明しましょう」を削除する方法
ワードプレスのバージョン5くらいになってから、
メディアの添付の画面にこれが出るようになりました。
この「画像の意味を説明しましょう」のリンクが激しく邪魔。
いっつも誤クリックしてしまうので、消し去りたい。
本当、人間のクリック精度はそんなに高くないぞっ!
削除方法
次のPHPファイルを修正します。
「wp-includes/media-template.php」の165行目あたり。
$alt_text_description = sprintf(
/* translators: 1: link to tutorial, 2: additional link attributes, 3: accessibility text */
__( '<a href="%1$s" %2$s>Describe the purpose of the image%3$s</a>. Leave empty if the image is purely decorative.' ),
esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ),
'target="_blank" rel="noopener noreferrer"',
sprintf(
'<span class="screen-reader-text"> %s</span>',
/* translators: accessibility text */
__( '(opens in a new tab)' )
)
);
この部分を全部コメントアウトします。
// $alt_text_description = sprintf(
/* translators: 1: link to tutorial, 2: additional link attributes, 3: accessibility text */
// __( '<a href="%1$s" %2$s>Describe the purpose of the image%3$s</a>. Leave empty if the image is purely decorative.' ),
// esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ),
// 'target="_blank" rel="noopener noreferrer"',
// sprintf(
// '<span class="screen-reader-text"> %s</span>',
/* translators: accessibility text */
// __( '(opens in a new tab)' )
// )
// );
これにて完了。
スッキリしました。
注意点
ワードプレスの更新でまた元に戻ると思います。
根本的には、function.phpなどで対処しないといけないと思います。
しかし、自分にはそのやり方がわからない。
ここはプロの方がコメントで教えてくださると信じてお待ちしております。
是非ご感想・ご指摘等をください。