how to disable the editors auto image link funktion?

Hi there!
Nothing seems to work so far, i tryed it in functions.php this way:

<?php
/**

  • Travelify defining constants, adding files and WordPress core functionality.

*/

/**

  • Set the content width based on the theme’s design and stylesheet.
    */
    if ( ! isset( $content_width ) )
    $content_width = 700;

if ( ! function_exists( ‘travelify_setup’ ) ):

add_filter(‘widget_text’, ‘do_shortcode’);

/**

  • Sets up theme defaults and registers support for various WordPress features.
    */
    add_action( ‘after_setup_theme’, ‘travelify_setup’ );

/**

  • Note that this function is hooked into the after_setup_theme hook, which runs
  • before the init hook. The init hook is too late for some features, such as indicating
  • support post thumbnails.

*/

function travelify_setup() {
/**
* travelify_add_files hook
*
* Adding other addtional files if needed.
*/
do_action( ‘travelify_add_files’ );

/* Travelify is now available for translation. */
require( get_template_directory() . '/library/functions/i18n.php' );

/** Load functions */
require( get_template_directory() . '/library/functions/functions.php' );

/** Load WP backend related functions */
require( get_template_directory() . '/library/panel/themeoptions-defaults.php' );
require( get_template_directory() . '/library/panel/metaboxes.php' );
require( get_template_directory() . '/library/panel/show-post-id.php' );

/** Load Shortcodes */
require( get_template_directory() . '/library/functions/shortcodes.php' );

/** Load WP Customizer */
require( get_template_directory() . '/library/functions/customizer.php' );

/** Load Structure */
require( get_template_directory() . '/library/structure/header-extensions.php' );
require( get_template_directory() . '/library/structure/sidebar-extensions.php' );
require( get_template_directory() . '/library/structure/footer-extensions.php' );
require( get_template_directory() . '/library/structure/content-extensions.php' );

/**
 * travelify_add_functionality hook
 *
 * Adding other addtional functionality if needed.
 */
do_action( 'travelify_add_functionality' );

// Add default posts and comments RSS feed links to head
add_theme_support( 'automatic-feed-links' );

// This theme uses Featured Images (also known as post thumbnails) for per-post/per-page.
add_theme_support( 'post-thumbnails' );

// This theme uses wp_nav_menu() in header menu location.
register_nav_menu( 'primary', __( 'Primary Menu', 'travelify' ) );

// Add Travelify custom image sizes
add_image_size( 'featured', 670, 300, true );
add_image_size( 'featured-medium', 230, 230, true );
add_image_size( 'slider', 1018, 460, true ); 		// used on Featured Slider on Homepage Header
add_image_size( 'gallery', 474, 342, true ); 				// used to show gallery all images

// This feature enables WooCommerce support for a theme.
add_theme_support( 'woocommerce' );

/**
 * This theme supports custom background color and image
 */
$args = array(
	'default-color' =&gt; '#d3d3d3',
	'default-image' =&gt; get_template_directory_uri() . '/images/background.png',
);
add_theme_support( 'custom-background', $args );

/*
 * Let WordPress manage the document title.
 * By adding theme support, we declare that this theme does not use a
 * hard-coded &lt;title&gt; tag in the document head, and expect WordPress to
 * provide it for us.
 */
add_theme_support( 'title-tag' );

/**
 * This theme supports add_editor_style
 */
add_editor_style();

}
function setup_default_image_link() {
$original_setting = get_option( ‘image_default_link’ );
if ($original_setting !== ‘none’) {
update_option(‘image_default_link’, ‘none’);
}
}
add_action(‘admin_init’, ‘setup_default_image_link’, 50);
endif; // travelify_setup
?>

whats wrong here? i dont realy get it.

Thanks in advance!
Dominik

Hi Dominik,

I hope you are well today and thank you for your question.

I am not sure what you meant by disabling the editors auto image link function so could you please describe it a bit more in detail so that i can help you?

Kind Regards,
Movin

Hi Movin,

If i add a picture to a post, it automaticly links to the mediafile. This should stop, there should not be any link attached to the picture.

Thanks in advance,
Dominik

You can achieve this by setting Image Link to None as shown in the attached screenshot.

My question is, how to make “none” the standard choice.

You can achieve this by using this plugin No Image Link – WordPress plugin | WordPress.org or using the following custom code.

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);