Title: shortcode not render in input value
Last modified: June 13, 2024

---

# shortcode not render in input value

 *  [Ty Chhoun](https://wordpress.org/support/users/tychhoun/)
 * (@tychhoun)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/shortcode-not-render-in-input-value/)
 * Dear all.
   function get_post_title_shortcode( $atts ) {    $atts = shortcode_atts(
   array(        ‘id’ => get_the_ID(),    ), $atts, ‘post_title’ );    $post_title
   = get_the_title( $atts[‘id’] );    return $post_title;}add_shortcode( ‘get_post_title’,‘
   get_post_title_shortcode’ );I have create a function for short code it working
   well,but when I want it reader in INPUT as value Elementor HTML it not render
   EX: <input type=”hidden” mane=”tourCode” value=”[get_post_title]” />Anyone got
   this issue please share ideas?ThanksTY

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

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/shortcode-not-render-in-input-value/#post-17823487)
 * The condition for output is that an IP is available via `get_the_ID()`. Are you
   calling a single page? This will not work for archive pages, except perhaps in
   a loop. The context in which you insert the shortcode would therefore be very
   important.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/shortcode-not-render-in-input-value/#post-17823990)
 * Besides context being important in general, shortcodes within HTML tags will 
   not be expanded as you are thinking they would be. In order to use a shortcode’s
   value within an input field, the shortcode would need to generate the entire 
   tag within it’s expanded content. For example, `[title_field]` could be expanded
   into `<input type="hidden" name="tourCode" value="A Post Title">`, assuming the
   post’s title is available via code. Success still depends on context.
 *  Thread Starter [Ty Chhoun](https://wordpress.org/support/users/tychhoun/)
 * (@tychhoun)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/shortcode-not-render-in-input-value/#post-17824306)
 * Yes I use it in single post!
   In that page I have custom form submit, so I need
   input hidden field to keep current page or post title embed when I submit sent
   email, that I need <input type=”hidden” mane=”tourCode” value=”[get_post_title]”/
   >Any better solution?
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/shortcode-not-render-in-input-value/#post-17825820)
 * WP will not “see” shortcodes within a HTML tag. As I said earlier, your shortcode
   would need to generate the entire tag, not just the field’s value.

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

The topic ‘shortcode not render in input value’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 4 replies
 * 3 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [1 year, 10 months ago](https://wordpress.org/support/topic/shortcode-not-render-in-input-value/#post-17825820)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
