Thursday, April 16, 2015

#500 - Get post's featured image from any post in your WordPress Multisites network

To get post's featured image from any post in your WordPress Multisites network, use this function:



For example, get the featured image of post_id 2 of blog_id 3:

<?php $myfeaturedimage_src = wp_get_post_featured_image_src(2, 3, 'full')[0]; ?>

<img src="<?php echo $myfeaturedimage_src; ?>">


References:

[0] Original author: https://gist.github.com/bamadesigner/f5a338805d28f9c15df7
[1] Backup link: https://github.com/dangtrinh/WordPress_Multisites_Utilities_Plugin/blob/master/ssis_blog_plugin.php


Notes: This is my 500th post!!!