Title: Meta box value shortcode
Last modified: August 20, 2016

---

# Meta box value shortcode

 *  Resolved [jasonsweb](https://wordpress.org/support/users/jasonsweb/)
 * (@jasonsweb)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/meta-box-value-shortcode/)
 * Hi,
 * I’m trying to achieve the following:
    A shortcode of my Custom Post Type “Testimonials”.
   In the WordPress editor the user enters the ID of the testimonial post (like [
   testimonial id=”74″]) and then the shortcode displays the correct testimonial.
 * In my shortcode file I’ve got the following code to get the title and content
   of the testimonial:
    ` $testimonial_id = get_post($id); $testimonial_title = 
   $testimonial_id->post_title; $testimonial_content = $testimonial_id->post_content;
 * This works perfect. But I’ve also got 1 meta box value I would like to get. But
   how do I retrieve this value?
    I’ve tried this: `get_post_meta($testimonial_id,'
   testimonial_company', true);`
 * Unfortunately this doesn’t work.
 * Does someone has an idea of what I’m doing wrong??
    Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/meta-box-value-shortcode/#post-3205205)
 * try:
 *     ```
       get_post_meta($id, 'testimonial_company', true);
       ```
   
 * or:
 *     ```
       get_post_meta($testimonial_id->ID, 'testimonial_company', true);
       ```
   
 *  Thread Starter [jasonsweb](https://wordpress.org/support/users/jasonsweb/)
 * (@jasonsweb)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/meta-box-value-shortcode/#post-3205210)
 * Awesome! Thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Meta box value shortcode’ is closed to new replies.

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 2 replies
 * 2 participants
 * Last reply from: [jasonsweb](https://wordpress.org/support/users/jasonsweb/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/meta-box-value-shortcode/#post-3205210)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
