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've enabled my theme with featured image support. The one thing missing is the ability to add a user-defined hyperlink to the image.

I'm pretty sure I can add a custom field, which I can then use to link to the image. However, I'd like this input field to be close to the featured image itself.

Ideally, just below the "Remove Featured Image" link and inside the featured image div.

I'd appreciate any help or insights you can provide to get my custom field attached to the featured image panel.

share|improve this question

you can do that in many ways , for example :

 add_filter( 'admin_post_thumbnail_html', 'add_something_to_feature_thumb_box');
    function add_something_to_feature_thumb_box( $myhtml ) {
        return $myhtml .= '<p>Put your HTML here - if you want a form, put the form.</p>';

or (better IMHO) :

function replace_post_thumbnail_box() {
        global $post; // get post

        echo '<p> if you want custom field above place code here .</p>';

        $thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true ); // thumbnail ID from post array
        echo _wp_post_thumbnail_html( $thumbnail_id );

        echo '<p>if you want custom field below place  code here .</p>';
function render_new_post_thumbnail_meta_box() {
        global $post_type; 

        // get rid of the old  box..
        remove_meta_box( 'postimagediv','post','side' );

        // ..and render the new one
        add_meta_box('postimagediv', __('Featured Image'), 'replace_post_thumbnail_box', $post_type, 'side', 'low');
add_action('do_meta_boxes', 'render_new_post_thumbnail_meta_box');
share|improve this answer

protected by toscho Aug 19 '14 at 19:22

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.