WordPress offers a very complete media upload dialog. However, some projects might require users to be able to attach files right from the post editor. This recipe shows how to modify the post editor form to be able to attach files to articles and how to store these files once they have been uploaded. While any type of file could be attached using this technique, the code will be written to accept only items with a PDF file extension.
You should have access to a WordPress development environment, either on your local computer or a remote server, where you will be able to load your new plugin files.
- Navigate to the WordPress plugin directory of your development installation.
- Create a new directory called
- Navigate to this directory and create a new text file called
- Open the new file in a code editor and add an appropriate header at the top of the...