Building With


Useful tips for building advanced blocks.

Force Download Button

When you click on a link to an image, WordPress generally opens the image on the same page or a different page. It does not give you the option to download the image.

For my Doodle Line Icons project, I wanted to allow users to directly download the SVG file rather than opening the file on a separate page, then having to right-click on the image to save it.

One workaround is to use the download attribute as in the example below.

<a href="/uploads/doodle-line/Chat-Text-Right.svg" download>


Add a Button (from the GenerateBlocks plugin, not the default option from WordPress) and insert the link to the file you wish users to download.

Adding Link v1


Click on Advanced on the right-hand side and scroll to the bottom. You should see an option to add Custom Attributes.

Advanced Add Attribute


Type download into the field and click on Save as Draft or Publish the article.

Add Attribute Download

Final Results

Click on Preview > Preview in a new tab. On the preview page, click on the Download button, it should allow you to download the file directly.

Leave a comment