If you’re using Apache, you can add something like this in your .htaccess file
AddType application/octet-stream .pdf
This will force everything with a .pdf extension to download instead of display in the browser.
If however you are not using Apache or if you want only certain files to download and others to display directly, you could use PHP to do this.
<?php
header("Content-disposition: attachment; filename=myfile.pdf");
header("Content-type: application/pdf");
readfile("myfile.pdf");
You could then link to this php file to download the PDF.
Related Posts:
- Add Watermark to PDF’s of logged in user in WordPress upon upload to media library [closed]
- How do I embed youtube videos with https instead of http in the URL?
- WP Oembed not passing through the “autoplay=1” variable
- How can I change Max Embed Size in WordPress 3.5?
- Soundcloud embed shortcode does not work
- wp_embed_register_handler not working
- Embed .mov file via ‘Add Media’ not working
- How to change thumbnail of embedded Youtube video?
- How to add new embed handler not supported by oembed
- Manipulating oembed_dataparse stopped working for YouTube embeds
- Youtube – Embed as IFRAME
- How to change WordPress embedded player size or show just the play button
- wp_embed_register_handler is not working
- use of tag into wordpress
- Any way to use a custom Parameter for vimeo embed without using an iframe?
- Is it possible to modify the default YouTube embed attributes string?
- ted talks embed fixed, but can’t control size
- Removing WordPress Icon from oembed link footer
- How to embed a WordPress article on another website [closed]
- Hiding Comments Icon On oembed
- Youtube parameters within WordPress embed code?
- How to create a static player top or bottom of wordpress?
- Audio Playlists – Multiple file type support?
- Vimeo video embeds doesnt seem to work with ACF [closed]
- vimeo/youtube video embed with thumbnails
- Embed YouTube video from custom field value
- Search XML file from within WordPress?
- WordPress keeps altering my embed code
- Can I use wp_oembed_get to detect a valid embeddable link or is there a better way to do so?
- disable video URL auto-embedding for a part of the post
- Embeding YouTube video via a template function throws iframe cross-domain policy error
- extra text in Vimeo Embedded videos
- Check if page is embeded
- How can I override print_embed_sharing_dialog() in WordPress 4.5
- Video Embed with Captions in Turkish
- Embed Post in external page
- How can I force oEmbed to display fixed height & width dimensions?
- YouTube embed parameters?
- Embed Youtube video link in wordpress editor
- WordPress get embedded/attachment video
- Outside url for post content
- want to stop stripping out from my post content
- How to auto embedded youtube with wp_insert_post()
- Is there a way to create embed codes from wordpress/buddypress content?
- Display total questions of Moodle in WordPress [closed]
- How to display real-time data which is stored in an IBM Cloud web app
- MP4 video on wordpress working on desktop, not on mobile devices
- Embedding custom posts with REST API
- How to Implement Responsive YouTube Video Framing? [closed]
- How to change the way wp_embed handles only youtube videos?
- Embed interactive pdf
- How to embed YouTube videos in posts without adding suggested videos at the end?
- How to make my new theme read [youtube id=”id of the video here” width=”600″ height=”350″]?
- How to put an external object into WordPress to that occupies most of the available space?
- Div around YouTube video
- Embedding Youtube video on comments
- Reusing header.php from Yii application
- Add custom parameters in SoundClound embed
- How to make enqueue_embed_scripts work with the embed_template filter
- How do I not embed the SoundCloud player? I just want the link
- YouTube embeded video will not resize (only full screen responsive) [closed]
- How can I embed an Excel spreadsheet that allows users to edit certain fields, but is still “read-only”
- TED talk embedded videos cut off by sidebar
- Help with jot form pro embed code
- Embed PDF into wordpress
- WordPress fails to embed video URL
- changes after I save a post
- Embed a Google Docs in WordPress?
- embed via wp_embed_register_handler only works in front-end
- Add class and change src type inside wp_oembed_get
- Code playground (like CodePen) inside WordPress?
- Embed wikipedia page in WordPress?
- Embed post wont work on custom post type
- How to embed my latest WordPress post into an external page
- [embed]Using WordPress 5.5.1 there is no embed option after the video is uploaded
- Embedded videos not displaying on page
- Why does my custom html code (for a donation form) appear in a preview but not in the published post?
- Embed Microsoft Forms into WordPress page
- How to disable URL preview in WordPress comments
- Nofollow attribute in WordPress link embed code?
- Why most embed feature doesn’t work?
- Remove wordpress embed share icon?
- Youtube iframe embed keeps disappearing from page
- ‘[code]’ shortcode to markup programming code does not work
- WordPress Mediaelement – Youtube Videos Embed Options
- Embedding multiple song players on one page without it effecting the load time
- how to embed a .mp4 video the url postfix with secret key
- Adding an official oEmbed provider to WordPress
- CartoDB embedding doesn’t work
- My WordPress editor deletes all characters after emoji – how can I fix this?
- Do_Shortcode not working for Embed any tweet
- How to embed php page from separate site
- Increase size of Google Document Site Wide [closed]
- How to have embedded images from smugmug take full width of blog posts
- WordPress: embedding last posted video
- Enclosures being deleted “automatically”
- How can I create iframe/embeddable content from my WordPress site?
- Completely disable oEmbed and auto-embed on frontend and post editor?
- How to anchor to embed video
- Embed links work on new page creation, not on edit