WordPress makes it pretty easy to add images to a page or post, but how do you add a PDF or Word document to a post? Update added for Gutenberg Blocks. It’s even easier now but with some limitations.
Now that Gutenberg has been released, Linking to a PDF is different.
- Link to a PDF in WordPress Gutenberg
- Link to a PDF in WordPress Classic Editor
- Workaround to Link to PDF in WordPress Gutenberg Paragraph and List Blocks
Limitations of the Gutenberg File Block
In Gutenberg, you use the File block to link to files such as PDF or MS Word documents. There are, however, several limitations to the File block that will prevent you from linking to PDF files like you did in the Classic Editor.
The File block is an individual block, and as such, it cannot be added to another block. As a result, you can’t use the File block to add a PDF file link in a paragraph or list.
Unfortunately, lots of people use unordered lists to list links to PDF files. And lots of people link to PDF files from within a paragraph. If you still want to link to PDF files in this way, I recommend that you install the Classic Editor and continue to use that until Gutenberg includes these features.
Or, you can insert the Classic Block and then link to PDF files the same way you do in the Class Editor. The nice thing about this method is that you can enjoy the advantages of the new Block Editor while still using features you need from the Classic Editor.
You can install the Classic Editor even if you already installed WordPress 5.x / Gutenberg. Furthermore, once the Classic Editor is installed, you can open any post or page using the Classic editor. With the Classic Editor installed, go to Settings > Writing to specify if the Block or Classic editor is the default and if the user can choose which editor they want to use to open a post or page. With the Classic editor installed and with the correct settings in Settings > Writing, WordPress will work just like it did before version 5.x / Gutenberg.
Finally, if you want to continue using the Block editor, there is a workaround to add PDF links to paragraphs and lists.
Link to a PDF in WordPress Gutenberg
- Open a post or page, put your cursor in the block where you want to add the PDF link, and click the Add Block button.
- Select the File block.
- Click Upload or Media Library and navigate to the PDF file or document you want to link to. If you are uploading a PDF, it will automatically upload to your media folder.
- Select the PDF you want to link to and click Select.
- Adjust the PDF Settings.
– Click Open in New Tab if you want the pdf to open in a new tab.
– Click Show Download Button if you want to show a file download button. The Download buttons allows the user to download the pdf rather than view it.
- Click Save or Update to save your changes.
Link to a PDF in WordPress
- Open a post or page, put your cursor where you want to add the PDF link, and click Add Media.
- Click Select Files and navigate to the PDF file or document you want to link to.
- In the Insert Media screen, make sure the PDF you want to link to is checked.
- In the Title field, enter the text you want to use for the PDF link.
- Make sure Media File is selected in the Link To field.
- Click Insert Into Post to add the PDF link.
- Your PDF link is inserted into the text.
Note: If you link to a MS Word .doc file or a an Excel file, it will not display in the user’s browser. It will download the file to the user’s device. Click here if you want to link to an MP3 file.
Workaround to add PDF links to Gutenberg Paragraph Blocks and List Blocks
This procedure requires that you get the PDF or File URL from the Media Manager and then add that URL to a link in a Gutenberg Paragraph or List block. This procedure works on Gutenberg Paragraph and List blocks.
- From the WordPress Admin screen, go to the Media and select the PDF you want to link to.
The Attachment Details Screen is displayed.
- Copy the PDF URL.
- Open a post or page and select the link text in the Paragraph or List block.
- Click the Link button and paste the PDF URL you copied in Step 2.
- Click Link Settings.
- Select Open in New Tab
- Click the Apply button to add the link.
- The link is inserted in the text. If you click on the link, you can see the PDF URL.
- Click Save or Update to save your changes.
Laura Rajsic-Lanier says
This does not work with bulleted lists.
When I change the blocks to a bulleted list, it makes it one block. So, the individual PDFs I’d normally link to with ease within a bulleted list now require me to upload the graphics, get the link to each, then manually put it in.
For me, this is a massive disappointment as the post / page combos I did with the old WordPress took 30-45 minutes, I’m now well over 3 hours for the same post / page creation.
As annoying as this is, the randomly eaten blank spaces in my text blocks is even worse.
I would warn against upgrading to WordPress Gutenberg. I wish I hadn’t.
Hi Laura, I agree, there are some issue with Gutenberg that need to be worked out. Not being able to easily link to files from within a block is unacceptable. It’s the same issue for images: you can’t add them to a bulleted list.
There are a couple things you can do to work around the PDF issue. 1. install the Classic Editor plugin. That allows you to continue to use the classic editor with WordPress 5.x / Gutenberg installed. Also, go to Settings > Writing and make Classic Editor the default editor and click “No” to Allow Users to Switch Editors. That way, you won’t even see the link to the Block editor in the page or post lists. 2. If you want to continue using the Block editor, you can link to pdf files by going to the Media manager and copying the pdf link. Then create a link in the list and paste the pdf url.
Why should we have to go to all of that effort simply to have a capability that already existed. The WordPress developers and their management clearly don’t give a damn about their users!
Frankly the difficulties in linking to a pdf with the new Gutenberg version of WordPress are completely unacceptable. I would strongly discourage anyone from using WordPress given the complete insensitivity of WordPress to its users. This is absolutely unacceptable and we will be discontinuing all of their products. I am pissed!!
I have an alternative method I use to add media to lists. I simply create a classic block and do the list there, complete with an add media button. It sure seems like a large oversight not to add an “add media” button to the list and paragraph blocks. It’s a situation where “new” is not necessarily “improved.”
Thanks for your help. Happy still using the classic editor :)