Finally by luck i found the answer by @Tomas
function gallery_template_to_posts() {
$post_type_object = get_post_type_object( 'post' );
$post_type_object->template = array(
array( 'core/gallery', array(
'linkTo' => 'media',
) ),
);
}
add_action( 'init', 'gallery_template_to_posts' );
Related Posts:
- How to extend the gallery block in Gutenberg?
- get_post_gallery with Gutenberg
- How to include externally hosted images into a gallery block
- How to get the Gallery form/section just like in Gutenberg block?
- get_post_gallery with Gutenberg
- Convert multiple image blocks to gallery block in Gutenberg?
- get_post_gallery with Gutenberg
- How do I delete all UNUSED images from my uploads directory?
- Set default image link target in Gutenberg image block
- WordPress adding scaled images that don’t exist (1536×1536 and 2048×2048)
- How to have different captions for same image, for galleries?
- get_post_gallery_images returns thumbs . I want full size
- WP 3.5 and Galleries – how to count images?
- Navigate with keyboard in Gallery shortcode
- Cropped featured image replaces original image in gallery
- Change the output for [gallery] shortcode
- Making WordPress Gallery (.gallery-item) Responsive?
- Apply image width to tag
- Excludes posts that don’t have attachments in the_content()
- Setting up a gallery with images and a zip download
- How to remove title attribute from gallery links and images
- How can I make all gallery images to open in a new window?
- The WordPress Gallery, Grabbing The Link and Images?
- How to force WordPress to add new images at the beginning of the gallery?
- How to Make WordPress Default gallery responsive on mobile?
- Different captions for the same image in multiple galleries. Edit Image in Gallery locally
- @wordpress/create-block image url in css
- Editing built in Gallery shortcode to filter by categories
- Gallery images stored elsewhere (preferably Google Drive)
- WordPress gallery previous/next buttons showing all media library images
- Any way to “combine” galleries or show multiple galleries as one?
- How to remove buttons from gutenberg toolbar
- Extend core block attributes in post content
- hardcrop images in gutenberg “latest posts” block
- Best option for photo/gallery handling?
- Gallery post images on homepage?
- How to create a simple slideshow out of a post image gallery?
- How to change the target size of images clicked on in WordPress standard gallery
- Exclude featured image from gallery in wp-admin
- Trying to create a mouseover effect in html using Gutenberg editor
- WooCommerce-like featured gallery
- Extracting gallery images in WordPress 3.5 on index.php
- wordpress get gallery images title
- How to use photo in multiple posts?
- Customizing the attachement page to show rest of all images in a gallery from post
- Retrieve an array of image URLs that belong to a gallery
- Add width & height attributes to Gutenberg’s image output?
- Ho to add “Create Slider” option to default “Add Media” popup?
- How to make a gallery with dynamic images from URLs?
- How can I display an image description, from an image gallery?
- Creating a post image to show in a gallery
- Don’t show images inserted into content
- Ways to show multiple, separate galleries per post?
- Native gallery sorting is ignored
- Using Jetpack carousel w/o creating a gallery [closed]
- Load Gallery Images with Title on Homepage BX Slider
- Re-ordering images in existing post in wordpress 3.6.1
- Autosort uploads in galleries by filename
- How to display original unmodified thumbnail
- One picture belonging different galleries?
- Is there a wordpress filter to edit the markup of inline images?
- How can I check if the first block is an image aligned left or right?
- Not seeing text alignment option in Image block
- How to remove the images from “Uploaded to this post”?
- limit number of images shown from gallery
- What is the plugin to import image from URL?
- Pagination between images (active/inactive)
- photo gallery implementation like tmz
- Can i have 2 separate Galleries on 2 separate pages each go to a DIFFERENT Attachment.php file?
- How to enlarge thumbnail on mouseover?
- Place image caption outside of figure tag (Gutenburg Image Markup)
- Change Image Size option in the settings in bulk
- How to disable a WP Image Block to link to itself?
- How to join Caption AND Description Meta Fields as one combined-caption in Image Block
- Allow users to upload and display multiple photos
- How to change Gallery image url in product page ? In function.php?
- How do you obtain a list of all image file names on a wordpress website for replacement?
- Implementing a modal(lightbox) for all images in all post-gallery posts
- Rebuilding core image block
- Images getting smashed
- How to re-arrange images in default WP Gallery more than one image at once?
- A query to substitute images paths in gutenberg (website migration)?
- Images 404 after wp migration to a subdomain
- Exclude first image from a Woocommerce image gallery
- Gallery Images could not be shown
- Gallery with shortcode not showing
- Show WordPress Image Title Under Custom Portfolio Image
- Replacing an Image gallery
- attachment.php & flexslider—linking thumbnail to specific image
- Thumbnail gallery by date and taxonomy
- How to display every pictures from all the posts on one page?
- How to add multiple images in a page
- Breadcrumbs for Single Image page
- Slider do not add alt attribute. Cant get alt attribute from a media library!
- Paginate Gallery [closed]
- Custom filename when pasting an image from clipboard
- Adding different classes to different images depending on size for fine control of image layout in posts
- Image Attachments Query Not Working If Post Is Loaded Via Ajax
- Gutenberg block HTML image rendering override
- Images uploaded in customized gallery do not link to media