Set attachment’s default “Link To” value
When inserting an attachment into a WordPress post, we can customize how it should be displayed. There are three settings; Alignment, Link To and Size. Here’s how we can tell WordPress to select None as the default value of Link To:
/**
* Set default media link to 'none'
*
* @param string $value Option value
* @wp_hook filter pre_option_image_default_link_type
* @return string
*/
function _kucrut_image_default_link_type( $value ) {
return 'none';
}
add_filter( 'pre_option_image_default_link_type', '_kucrut_image_default_link_type' );
As of WordPress 4.0, there are four values available: file
(default), post
, custom
and none
.
Posted on in Tips & Tutorials.