Created
November 5, 2015 18:02
-
-
Save blainerobison/c662cc262e989a3aaa76 to your computer and use it in GitHub Desktop.
Remove default link to media file when adding to WYSIWYG editor in WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove Link When Adding Media | |
* | |
* Adding media to a WYSIWYG editor can sometimes automatically include a link | |
* to the file. This sets the default behavior for all users to none. | |
* | |
* @return void | |
*/ | |
function prefix_media_linking() { | |
$setting = get_option( 'image_default_link_type' ); | |
if ( $setting !== 'none' ) { | |
update_option( 'image_default_link_type', 'none' ); | |
} | |
} | |
add_action( 'admin_init', 'prefix_media_linking', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment