Home / admin / Add HTML to feature image metabox
  • How to Add HTML to feature image metabox

    add-html-to-feature-image-metabox

    Adding this snippet to the functions.php will let you add HTML to the featured image metabox. This could be use to add extra information for your clients on how to use this feature.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    add_filter( 'admin_post_thumbnail_html', 'add_featured_image_html');
    function add_featured_image_html( $html ) {
        return $html .= '<p>This is some sample text that can be displayed within the feature image box.</p>';
    }
    

    ( WordPress codex functions, hooks, in this snippet. )

    add_filter,
  • Mark

    hi. do you know how to set this for individual custom post types?

    • You could use something like this:

      if(‘custom_post_type’ == get_post_type()) {

      return $html .= ‘Description’;

      }