Fetching uploaded images using Link URL

I want to fetch that uploaded image re-size it into a thumbnail and display it on the browser when i publish it..all of this programmatically.. is there a way to do it? You don’t need to do this manually. The add_image_size() function and the wp_get_attachment_image_src() function allow you to create and display alternate sizes for … Read more

How to remove a tab in Media Upload page in wordpress

I’m not sure it has to do with enqueueing, if all you want to do is hide the Media Library tab in the media upload window. I found the following solution (haven’t tried it myself): function remove_media_library_tab($tabs) { unset($tabs[‘library’]); return $tabs; } add_filter(‘media_upload_tabs’, ‘remove_media_library_tab’); The link contains some more details as to why this is … Read more

Attaching images to multiple galleries

If you open wp-includes/media.php file you will see such code in gallery_shortcode function: … if ( !empty($include) ) { $include = preg_replace( ‘/[^0-9,]+/’, ”, $include ); $_attachments = get_posts( array(‘include’ => $include, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => $order, ‘orderby’ => $orderby) ); … } … It means that you … Read more

Prevent other editors from viewing images of other editors in Add Media Popup

If I correctly understand your question, you may try this function wpse78084_show_media_by_current_author_only($query) { global $pagenow, $user_ID; if( ‘upload.php’ == $pagenow && !current_user_can(‘manage_options’) ) $query->set(‘author’, $user_ID); return $query; } if ( is_admin() ) add_filter(‘pre_get_posts’, ‘wpse78084_show_media_by_current_author_only’);

Filter causing loss of _wp_attachment_metadata

Given that that is a filter, it should be returning $metadata instead of returning nothing. add_filter( ‘wp_generate_attachment_metadata’, ‘mvt_save_photo_credit’, 10, 2 ); function mvt_save_photo_credit( $metadata, $attachment_id ) { add_post_meta($attachment_id, ‘_mvt_credit’, $metadata[‘image_meta’][‘credit’], true); return $metadata; // <– giving back what we got } I was able to duplicate the issue you describe, and that small change fixed … Read more

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