Blog Post: WordPress Posting Fix

Red Deer & Blackfalds Web Design Writes:

After the most recent WordPress update it became evident that there instances (in some cases) that when posting to a variety of Social Medias that they were no longer pulling the Excerpt or Featured Image from your blog post to your media post. This is an issue for most bloggers as it does not allow for the same attractive blog post on your Social Media stream that would give you a higher “Click Through” rate.

There is, however, a fix that as long as you feel comfortable Adding Child Themes to your WordPress Website, whereby you can actually just create an additional functions.php file and add the following code:

function insert_image_src_rel_in_head() {
global $post;
if ( !is_singular()) //if it is not a post or a page
if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
$default_image=””; //replace this with a default image on your server or an image in your media library
echo ‘‘;
$thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘medium’ );
echo ‘‘;
echo ”
add_action( ‘wp_head’, ‘insert_image_src_rel_in_head’, 5 );

This will in turn grab both the Featured Image from your specified post, or it will use the default image you specify on this line:

$default_image=””; //replace this with a default image on your server or an image in your media library

Joshua Neufeld

Owner at Red Anchor Studio
At Red Anchor Studio we are dedicated to building local business! We offer high quality developments at an affordable price, and we can work to get your business online at any budget.

Latest posts by Joshua Neufeld (see all)