Title: Run do_shortcode() inside variable, not working&#8230;
Last modified: August 21, 2016

---

# Run do_shortcode() inside variable, not working…

 *  [jstudios](https://wordpress.org/support/users/jstudios/)
 * (@jstudios)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/run-do_shortcode-inside-variable-not-working/)
 * So I’m trying to make a variable contain the output of a shortcode and output
   it to a text file like so:
 *     ```
       $login_logo_url = do_shortcode( $jf_options['loginlogolk'] );
       file_put_contents( $file, $login_logo_url);
       ```
   
 * But when I look at the text file it’s just the shortcode itself. I tested the
   shortcode in a page and it’s working. What am I doing wrong?

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

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/run-do_shortcode-inside-variable-not-working/#post-4285316)
 * What is the value of `$jf_options['loginlogolk']`? It must be a simple string,
   if it were a string element in a one element array for example, `do_shortcode()`
   will fail. As a test, hardcode the actual string and see what happens.
 * Where is this code executed? Could it run before the corresponding `add_shortcode()`
   is called?
 * Could another plugin (or your theme?) be interfering with shortcode handling?
 * These are the only things I can think of. Several people have had issues with`
   do_shortcode()` not doing, I don’t think there’s any kind of elusive bug, probably
   some variation of the above.
 *  [Wysija](https://wordpress.org/support/users/wysija/)
 * (@wysija)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/run-do_shortcode-inside-variable-not-working/#post-4285339)
 * Hello bcworkz!
 * We’d like to exchange with you, but can’t seem to find how to reach you, so we’re
   writing here.
 * We’re the guys behind this plugin: [http://wordpress.org/support/view/plugin-reviews/wysija-newsletters](http://wordpress.org/support/view/plugin-reviews/wysija-newsletters)
 * And we’d like to poke your mind about some support work. Get in touch with Kim
   here: [http://www.mailpoet.com/contact/](http://www.mailpoet.com/contact/)
 * Thanks, and sorry again for disturbing this thread.

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

The topic ‘Run do_shortcode() inside variable, not working…’ is closed to new replies.

## Tags

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

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 3 participants
 * Last reply from: [Wysija](https://wordpress.org/support/users/wysija/)
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/run-do_shortcode-inside-variable-not-working/#post-4285339)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
