Error 500 when using advanced sharing mode with post without image
-
Hi,
I found a bug. When we activate the Advanced share method, and a post doesn’t have a featured image, it’s cause an error, because the function get_the_post_thumbnail_url() doesn’t get an image (on line 498 and 610 of wp-linkedin-auto-publish.php).
For my need I’ve done a quick fix like this for the two places :
if ( has_post_thumbnail() ) { $json = json_encode( array( 'visibility' => array( 'code' => $options['wp_linkedin_autopublish_share_with'] ), 'comment' => $linkedinComment, 'content' => array( 'submitted‐image-url' => get_the_post_thumbnail_url($post->ID, 'full'), 'title' => html_entity_decode(get_the_title($post->ID)), 'submitted-url' => get_permalink($post->ID), 'description' => get_the_excerpt($post->ID) ), ) ); } else { $json = json_encode( array( 'visibility' => array( 'code' => $options['wp_linkedin_autopublish_share_with'] ), 'comment' => $linkedinComment, 'content' => array( 'title' => html_entity_decode(get_the_title($post->ID)), 'submitted-url' => get_permalink($post->ID), 'description' => get_the_excerpt($post->ID) ), ) ); }
But I’m not a developper, so there maybe/probably a best way to fix this.
I will stay tuned for next update, because I hate to have to modify plugin file!
Thank you,
Benjamin Dubé
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Error 500 when using advanced sharing mode with post without image’ is closed to new replies.