Skip to content

Instantly share code, notes, and snippets.

View saqibsarwar's full-sized avatar

Muhammad Saqib Sarwar saqibsarwar

View GitHub Profile
@saqibsarwar
saqibsarwar / attached_pdf_to_downloadable_file.php
Created September 7, 2022 18:02
Download Monitor and WP ALL Import - Attach PDF files to download CPT to make them downloadable.
<?php
// Start preparing an array to insert Download Monitor's Download Version (which is a CPT with Download as parent post).
$dlm_download_version = array(
'post_title' => 'Download #' . $download_id . ' File Version',
'post_type' => 'dlm_download_version',
'post_status' => 'publish',
'post_parent' => $download_id,
'post_author' => $attachment->post_author,
);