Support » Plugins » attachment_fields_to_edit Filter stopped working on 3.5 Elvin update?

  • The code in a plugin that uses the attachment_fields_to_edit filter to insert a link into the media-upload.php?tab=library page stopped working after an update to Elvin.

    Not sure why, because the code seems sound. Ideas? (note the bdn_attach pocket near the bottom).

    // Add the attachment link to the media library page
    add_filter( 'attachment_fields_to_edit', 'bdn_add_link_to_attach_image_to_post', 20, 2 );
    function bdn_add_link_to_attach_image_to_post( $fields, $attachment ) {
    
        if( empty( $_GET[ 'post_id' ] ) )
            return $fields;
    
        if( empty( $_GET[ 'tab' ] ) || $_GET[ 'tab' ] != 'library' )
            return $fields;
    
        $post_id = (int) $_GET[ 'post_id' ];
    
        if( empty( $post_id ) )
            return $fields;
    
        $nonce = wp_create_nonce( 'bdn-attach_' . $attachment->ID );
        $attach_image_action_url = admin_url( "media-upload.php?tab=library&post_id=$post_id" );
    
        $fields[ 'bdn_attach' ] = array(
            'label' => __('Attach to story:'),
            'input' => 'html',
            'html' => "<a href='$attach_image_action_url&bdn-attach=$attachment->ID&_attachnonce=$nonce'>Attach</a> "
        );
        return $fields;
    }
  • The topic ‘attachment_fields_to_edit Filter stopped working on 3.5 Elvin update?’ is closed to new replies.