Learn in this tutorial how to prevent a download from being displayed on the Easy Digital Downloads (EDD) archive page using code.
Easy Digital Downloads displays by default all downloads you have created in the plugin on its archive page, which will be /downloads/ unless you have modified the slug following this tutorial.
A subscriber told me that she had a download that she was interested in not showing it on that page. Are you also interested? Well, here’s how to get it.
Snippet to hide a download from Easy Digital Downloads file page
Add the following code at the end of functions.php or in your functionality plugin:
It’s as simple as that. You take advantage of the
pre_get_post hook along with the conditional tags so that the download archive page doesn’t show a specific download.
In this case, the download being excluded is the one with ID 5322.
To adapt the snippet to your case, you only have to change the download ID, that you can see when you hover over the download.
And if you want to hide more downloads, just add their ID separated by commas in the snippet above.
Do you want to stop showing one (or more) downloads on Easy Digital Downloads archive page? Now you know how to do it easily with code.
If you have any question, please leave it in the comments. And if you want to give me a suggestion for future snippets, please send it through the contact form.
Benefits of being a subscriber. 🙂