media_sideload_image results in http error (500)

The media_sideload_image() function is only available in the admin by default, and init runs on all page loads. See the Codex article: If you want to use this function outside of the context of /wp-admin/ (typically if you are writing a more advanced custom importer script) you need to include media.php and depending includes: require_once(ABSPATH … Read more

Add file upload with validation to custom form

<?php /* Template Name: Contact-Page-with-upload * * A Custom PHP Contact us page. Add or change form fields on line 28 and in the form itself. * Jquery is used to add/remove Bootstrap has-error class to invalid fields. */ /** * Get Error Class * * @return string; */ $response=””; function getErrorClass($failedKeys, $key) { if(isset($failedKeys) … Read more