Skip to content

Instantly share code, notes, and snippets.

View cawa-93's full-sized avatar
🇺🇦
Volunteer in Ukraine

Alex Kozack cawa-93

🇺🇦
Volunteer in Ukraine
View GitHub Profile
@cawa-93
cawa-93 / sideloader.function.php
Last active June 3, 2022 20:04 — forked from kellenmace/class-download-remote-image.php
Download and Insert a Remote Image File into the WordPress Media Library
<?php
namespace Plugin\Sideloader;
/**
* Function handles downloading a remote file and inserting it
* into the WP Media Library.
* @param string $url HTTP URL address of a remote file
* @param int $post_id The post ID the media is associated with
* @param string $desc Description of the side-loaded file
* @param string $post_data Post data to override