This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php /* This function attaches the image to the post in the database, add it to functions.php */ | |
function insert_attachment($file_handler,$post_id,$setthumb='false') { | |
// check to make sure its a successful upload | |
if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false(); | |
require_once(ABSPATH . "wp-admin" . '/includes/image.php'); | |
require_once(ABSPATH . "wp-admin" . '/includes/file.php'); | |
require_once(ABSPATH . "wp-admin" . '/includes/media.php'); |