Title: Default values from data
Last modified: March 8, 2019

---

# Default values from data

 *  Resolved [jonmojo](https://wordpress.org/support/users/jonmojo/)
 * (@jonmojo)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/default-values-from-data/)
 * I’m just getting into this plugin.
    - Can I call data from the database as a default value?
    - Can you add examples to the documentation as to what that might look like?
 * For example – I want to add a separate caption field to an image, using the caption
   of the image already select (in another field (image))

Viewing 1 replies (of 1 total)

 *  Plugin Author [Luke Carbis](https://wordpress.org/support/users/lukecarbis/)
 * (@lukecarbis)
 * [7 years ago](https://wordpress.org/support/topic/default-values-from-data/#post-11295279)
 * [@jonmojo](https://wordpress.org/support/users/jonmojo/) Hey thanks for touching
   base. Block Lab doesn’t have the ability to do this built in, but it might be
   able to be extended to do that. For example, you could do something along the
   lines of:
 *     ```
       <?php
       $caption = block_value( 'caption' );
   
       if ( '' !== $caption ) {
           echo $caption;
       } else {
           $default_caption_id = 42; // Default attachment post ID.
           echo the_post_thumbnail_caption( $default_caption_id );
       }
       ?>
       ```
   
 * Hope that helps!
    -  This reply was modified 7 years ago by [Luke Carbis](https://wordpress.org/support/users/lukecarbis/).
    -  This reply was modified 7 years ago by [Luke Carbis](https://wordpress.org/support/users/lukecarbis/).

Viewing 1 replies (of 1 total)

The topic ‘Default values from data’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/block-lab_5c34e8.svg)
 * [Block Lab](https://wordpress.org/plugins/block-lab/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/block-lab/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/block-lab/)
 * [Active Topics](https://wordpress.org/support/plugin/block-lab/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/block-lab/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/block-lab/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Luke Carbis](https://wordpress.org/support/users/lukecarbis/)
 * Last activity: [7 years ago](https://wordpress.org/support/topic/default-values-from-data/#post-11295279)
 * Status: resolved