The the post id from image id

The featured image is stored as post meta with the key _thumbnail_id, so you could use a meta query to get posts with a specific thumbnail: $posts = new WP_Query( array( ‘meta_query’ => array( array( ‘key’ => ‘_thumbnail_id’, ‘value’ => $attachment_id, ), ), ) ); Where $attachment_id is the ID of the image.

Show featured image option not in screen options

The “All Posts” page – /wp-admin/edit.php – does not show a featured image just by using WP Core. You have to add code to display featured images there. You may need to look back at your backups to see what code you were previously using to get the featured image to show up. It could … Read more

How to extract image width from add_image_size?

Generally speaking, there’s no need to do this. However, if it’s one added using add_image_size, it will be in the $_wp_additional_image_sizes global. global $_wp_additional_image_sizes; echo $_wp_additional_image_sizes[‘small’][‘width’];

Do I need to resize an image to fit the post?

You should use the built-in WordPress media manager to attach/insert images in posts. That way, if you define $content_width appropriately, WordPress will auto-resize large sized images to fit accordingly. Otherwise, you’ll have to rely on using CSS to set the max-width property for images within your content container (e.g. #content img{ max-width: 500px; height: auto; … Read more

HTML tags in WordPress image caption

I’m glad that better support should be added in version 3.4 but for now I’ve fixed the issue by changing the behaviour of image insertion so that it doesn’t use the shortcode. Here’s what I added to functions.php: add_filter( ‘disable_captions’, create_function(‘$a’, ‘return true;’) ); function image_send_to_editor_2($html, $id, $caption, $title, $align, $url, $size, $alt) { if … Read more

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