get_image_tag filter not working

Turned out my “answer” was that I didn’t really understand “get_image_tag.” It only runs when you first insert an image. I was thinking that it ran every time the edit interface was loaded. From researching and talking with others, it seems the only way to get the metabox data onto existing images is some kind … Read more

Get all images from posts with maximum number and without featured image

Try this: $image_count = 0; $max_images = 10; //set this to the max number of images you want. $ids = get_posts( array( ‘post_type’ => ‘post’, ‘posts_per_page’ => -1 ,’fields’ =>’ids’) ); if (count($ids) > 0){ foreach ($ids as $id){ while ($image_count < $max_images){ $args = array( ‘post_type’ => ‘attachment’, ‘numberposts’ => -1, ‘post_status’ => null, … Read more

Stop Attachment image names from taking top level permalink

Don’t link to attachment pages anywhere on your site and it won’t matter what permalink they have. Search engines only see what you make public. BTW another thing you can try is to upload only from within the post/page edit screen. That way attachments take up the parent post/page permalink. Sort of like example.com/post-name/attachment-name.

SQL: Search query to get attachments only of those parents which are published

Well since nobody helped with at first look such an easy problem, i used my way, and if somebody will need it here it is: I used this query: $results = $wpdb->get_results( $wpdb->prepare( “select $wpdb->posts.ID, $wpdb->posts.post_status, $wpdb->posts.post_parent from $wpdb->posts where post_title like ‘%%%s%%’ and (post_type=”albumas” OR post_mime_type=”audio/mpeg”) AND (post_status=”inherit” OR post_status=”publish”) $excludes limit 0,”.$setting->limit, ($setting->search_content … Read more

greater flexibility in targeting images attached to page

Every file that is uploaded in WordPress is an Attachment, which is a kind of post (‘post_type’ => ‘attachment’). When the file is uploaded inside a Post or Page, it is attached to that particular post/page (‘post_parent’ => $post->ID). I can think of a solution that doesn’t involves any particular coding: you simply have to … Read more

Loop issues when creating custom query for media uploader

I’m not entirely sure why the get_posts() function works instead of creating a new instance of WP_QUERY. From what I understand about how WordPress queries work, get_posts() is actually creating it’s own instance of WP_QUERY anyhow. Either way, here is the solution that I’m using currently. <?php //GET THE PHOTOGRAPHERS $args = array( ‘post_type’ => … Read more

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