首页 文章

如何在Wordpress后期编辑屏幕上的“精选图像”元框中添加消息

提问于
浏览
0

如何在Wordpress的“编辑帖子”屏幕上的“精选图像”元框中添加自定义消息?

screenshot of meta box in question

1 回答

  • 2

    https://wordpress.org/support/topic/edited-post-thumbnail-metabox-wont-display-correctly/找到答案

    /**
     * Add label to post thumbnail meta box
     */
    function swd_admin_post_thumbnail_add_label($content, $post_id, $thumbnail_id)
    {
        $post = get_post($post_id);
        if ($post->post_type == 'post') {
            $content .= '<small><i>(Add image larger than 700 x 458 px)</small></i>';
            return $content;
        }
    
        return $content;
    }
    add_filter('admin_post_thumbnail_html', 'swd_admin_post_thumbnail_add_label', 10, 3);
    

相关问题