Media Library Categories

I found a solution! My code changed quite a bit… Here is what the functions.php file looks like (which did not change): function wptp_add_categories_to_attachments() { register_taxonomy_for_object_type( ‘category’, ‘attachment’ ); } add_action( ‘init’ , ‘wptp_add_categories_to_attachments’ ); But here is the new code in footer.php, which returns the images from the Media Library, but only from an … Read more

Media Upload to custom database and Custom Directory

I suppose, you didn’t create table imageupload or can’t create folder if_images at your plugin folder. As a proposal I suggest you to use built-in WordPress functions and wordpress tables or create table on plugin activation. To create new table use function dbDelta. If you want to upload user files, use well-documented wp_handle_upload function. For … Read more

Import all media referenced in posts

Can I use get_attached_media() to get the images referenced on a page, even if they’re not formally attached? No, if they’re not attached they won’t be attached. I assume you’re talking about images in your posts that are offsite? If so, you need to download them, create an attachment post, attach it to the post, … Read more

Altered Media Library URLs

If you add this in the functions.php file in your themes folder: add_filter(‘upload_dir’, ‘new_upload_dir’); function new_upload_dir( $param ){ $mydir=”/wp-content/uploads”; $param[‘path’] = $param[‘path’] . $mydir; $param[‘url’] = $param[‘url’] . $mydir; error_log(“path={$param[‘path’]}”); error_log(“url={$param[‘url’]}”); error_log(“subdir={$param[‘subdir’]}”); error_log(“basedir={$param[‘basedir’]}”); error_log(“baseurl={$param[‘baseurl’]}”); error_log(“error={$param[‘error’]}”); return $param; } It should change the directory the images are uploaded into.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)