Add extra fields to the post’s featured image

In your case, you need to add custom fields to the metabox. The full reference code of the filter is here: ‘admin_post_thumbnail_html’ – https://developer.wordpress.org/reference/hooks/admin_post_thumbnail_html/. Let’s add an image title: <?php add_filter(‘admin_post_thumbnail_html’, ‘custom_featured_image_field’, 10, 2); function custom_featured_image_field($content, $post_id) { $custom_name = ‘custom_featured_image_title’; $custom_value = esc_attr(get_post_meta($post_id, $custom_name, true)); $output = sprintf( ‘<br><input type=“text” id=”%1$s” name=”%1$s” value=”%2$s”>’, $custom_name, … Read more

get_post_thumbnail does not display thumbnail

Make sure to use echo with get_the_post_thumbnail(): echo get_the_post_thumbnail(64 , ‘post-thumbnail’, array( ‘class’ => ‘img-format-big’ ) ); In WordPress, a rule of thumb (no pun intended) is to use echo with functions prefixed with get_. Functions prefixed with the_ on the other hand, display their output immediately (e.g. the_post_thumbnail() ).