As usual, we have to start by creating a plugin directory with a main plugin file, and inserting the header comments to define it as a plugin. We are not going to repeat the code in this section. You can find a directory and files for attachments addon inside the wpquick-attachments-addon directory in source codes. We are going to start the development by restricting the PDF files to users with a subscriber role. Let's implement the wpqpa_post_attachment_list_item filter we added in the previous section:
add_filter( 'wpqpa_post_attachment_list_item', 'wpqaa_post_attachment_list_item' , 10 ,2 );function wpqaa_post_attachment_list_item( $display, $file_data ){ $upload_dir = wp_upload_dir(); $file_dir = $upload_dir['basedir'] ...