Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
make Gutenberg Galleries link to Media File by default
// make galleries link to Media File
// https://wordpress.stackexchange.com/questions/115368/overide-gallery-default-link-to-settings
function make_galleries_link_to_file() {
$post_type_object = get_post_type_object( 'post' );
$post_type_object->template = array(
array( 'core/gallery', array(
'linkTo' => 'media',
) ),
);
}
add_action( 'init', 'make_galleries_link_to_file' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment