Title: Shortcodes into shortcode
Last modified: August 31, 2016

---

# Shortcodes into shortcode

 *  [Anzwers](https://wordpress.org/support/users/anzwers/)
 * (@anzwers)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/shortcodes-into-shortcode/)
 * I need an information if possible, because I don’t find anything arount about
   this situation.
 * I would like to run some shortcodes (or just one) called from another shortcode.
 * To do this I put this code under my child theme’s functions.php:
 *     ```
       add_shortcode('format', 'shortcode_block_format');
       function shortcode_block_format ( $atts ) {
   
       switch( $atts['which'] ) {
       case '1' : return do_shortcode('[my-old-shorcode]'); break;
       case '2' : etc etc
       }
       }
       ```
   
 * but when I write [format which =”1″] in the editor, and then I save the post,
   the result is just this written on the frontend page:
 * [my-old-shorcode]
 * So the new shortcode [format which =”1″] works because it makes the old shortcode[
   my-old-shorcode], but [my-old-shorcode] is no longer interpreted by wp, who “
   sees” it just like any other text.
 * The question is: there is a way to RUN a shortcode called from another one?
 * Thank you!!

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

 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/shortcodes-into-shortcode/#post-7181615)
 * That should work.
 * Is the old shortcode still used? Is it part of a plugin?
 *  Thread Starter [Anzwers](https://wordpress.org/support/users/anzwers/)
 * (@anzwers)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/shortcodes-into-shortcode/#post-7181661)
 * Dear Keesiemeijer, the old shortcode is a part of my plugin theme, it is still
   used and of course works fine.
 * For example: [gap] = x_shortcode_gap()
 * Thank you!
 *  Thread Starter [Anzwers](https://wordpress.org/support/users/anzwers/)
 * (@anzwers)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/shortcodes-into-shortcode/#post-7181666)
 * Wow Keesiemeijer I find the real issue (after your words)!!
 * My new shorcodes is able to run old shortcodes but not to run the “closure” of
   the shortcodes.
 * So it run [my-old-shorcode] but it print [/my-old-shorcode]!
    50% of the problem
   now…
 * Thank you!
 * Ps sorry, I discover that it wors only with old shotcodes without the closing/
 * Infact if I put [gap] into the new shorcodes it works, if I put [columnize] that“
   needs” the [/columnize] it does not… the [columnize] is not printed but it does
   not works, the [/columnize] instead is printed.

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

The topic ‘Shortcodes into shortcode’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [Anzwers](https://wordpress.org/support/users/anzwers/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/shortcodes-into-shortcode/#post-7181666)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
