WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I customized my featured image metabox position, the default name, and text for a custom post type. While I'm able to add/edit an image in post admin, after I have uploaded an image, the post admin doesn't show the new image in the metabox until after I save the post.

The featured images are set and I'm able to query and retrieve them in the frontend just fine.

Also, strangely, I can only upload images--it doesn't seem that I can insert existing images from the media library. Here's the relevant code below:

        // Add custom featured image box "sketch" using existing featured image metabox; remove default featured image box.
        public function image_box() {
            remove_meta_box( 'postimagediv', 'tn_cstm_sketchbook', 'side' );
            add_meta_box('postimagediv', __('Sketch'), 'post_thumbnail_meta_box', 'tn_cstm_sketchbook', 'normal', 'high');

        // Conditionally filter featured image text only for sketchbook custom post types
        public function add_featured_image_filter() {

            if ('tn_cstm_sketchbook' == get_post_type() ) {

                add_filter('admin_post_thumbnail_html', array($this, 'do_thumb' ));
                add_filter( 'admin_post_thumbnail_html', array($this, 'remove_featured'), 9999, 1 );


        public function remove_featured( $content ) {
            return str_replace( 'Remove featured image', 'Remove sketch', $content );

        public function do_thumb($content){
             return str_replace(__('Set featured image'), __('Add a sketch'), $content);

And here are the hooks that I'm calling them with:

public function __construct() {
        add_action( 'do_meta_boxes', array($this, 'image_box' ));
        add_action( 'admin_head-post-new.php', array($this, 'add_featured_image_filter' ));
        add_action( 'admin_head-post.php', array($this, 'add_featured_image_filter' ));
share|improve this question
Which hooks are you using to call the first two methods? – TheDeadMedic Jun 27 '13 at 6:09
Ah, just updated my post with the hooks below the original code. – tnog Jun 27 '13 at 7:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.