fix: problems with non-objects

pull/292/head
Seaton Jiang 2020-09-27 08:47:49 +08:00
parent 9a734f42e8
commit 73d61d2249
No known key found for this signature in database
GPG Key ID: C1086BAE716FF138
1 changed files with 3 additions and 1 deletions

View File

@ -3,7 +3,7 @@
* 站点相关函数 * 站点相关函数
* @author Seaton Jiang <seaton@vtrois.com> * @author Seaton Jiang <seaton@vtrois.com>
* @license MIT License * @license MIT License
* @version 2020.08.04 * @version 2020.09.27
*/ */
// 标题配置 // 标题配置
@ -104,6 +104,8 @@ function mourning()
function share_thumbnail_url() function share_thumbnail_url()
{ {
global $post; global $post;
if(!is_object($post))
return;
if (has_post_thumbnail($post->ID)) { if (has_post_thumbnail($post->ID)) {
$post_thumbnail_id = get_post_thumbnail_id($post); $post_thumbnail_id = get_post_thumbnail_id($post);
$img = wp_get_attachment_image_src($post_thumbnail_id, 'full'); $img = wp_get_attachment_image_src($post_thumbnail_id, 'full');