Skip to content

Instantly share code, notes, and snippets.

@hachesilva
Created December 10, 2018 00:19
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 hachesilva/490605c2f7444daf6e4e9c5c3e0da1f6 to your computer and use it in GitHub Desktop.
Save hachesilva/490605c2f7444daf6e4e9c5c3e0da1f6 to your computer and use it in GitHub Desktop.
How to Automatically Remove Default Image Links in WordPress
<?php
// Source: https://www.wpbeginner.com/wp-tutorials/automatically-remove-default-image-links-wordpress/
// functions.php
function wpb_imagelink_setup() {
$image_set = get_option( 'image_default_link_type' );
if ($image_set !== 'none') {
update_option('image_default_link_type', 'none');
}
}
add_action('admin_init', 'wpb_imagelink_setup', 10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment