Title: Shortcode doesn&#039;t work from another shortcode
Last modified: September 1, 2016

---

# Shortcode doesn't work from another shortcode

 *  Resolved [jse4](https://wordpress.org/support/users/jse4/)
 * (@jse4)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/shortcode-doesnt-work-from-another-shortcode/)
 * Hi,
 * I’m developing my own shortcode with a basic tags selector for filter with your
   plugin and show images that I desire.
 * If I use your shortcode from Admin Editor Page there is no problem and works 
   fine. But I want to do it dynamically based in a selected tags so I need to call
   do_shortcode for that generating tags_ids string.
 * The following from my own PHP is not working :
 * echo do_shortcode(‘[ngg_images source=”tags” tag_ids=”‘.$varTags.'” display_type
   =”photocrati-nextgen_basic_thumbnails”]’);
 * Where variable $varTags is the String that I said, comma formatted as : “blue,
   sky,cloud”
 * When do_shortcode calls ngg_images I get the following error :
 * Warning: addslashes() expects parameter 1 to be string, array given in <MY_SITE
   >/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/datamapper/
   package.module.datamapper.php on line 1337
 * no images were found
 * Hope you can help me with this problem… Thanks and great job!!
 * [https://wordpress.org/plugins/nextgen-gallery/](https://wordpress.org/plugins/nextgen-gallery/)

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

 *  Plugin Contributor [photocrati](https://wordpress.org/support/users/photocrati/)
 * (@photocrati)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/shortcode-doesnt-work-from-another-shortcode/#post-7597783)
 * [@jse4](https://wordpress.org/support/users/jse4/) – Without the context of your
   entire code construct it may be a bit difficult to sort out where you are having
   the issue.
 * Have you tried substituting in the expected `$varTags` value into your `do_shortcode`
   code above to see if the error persists? As it is, I am not seeing anything “
   wrong” with the shortcode you are trying to use.
 * Thanks!
 * – Cais.
 *  Thread Starter [jse4](https://wordpress.org/support/users/jse4/)
 * (@jse4)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/shortcode-doesnt-work-from-another-shortcode/#post-7597785)
 * Forcing **do_shortcode ** with desired tags works well. I don’t know why is not
   working… But I’m getting another problem. Suppose that media has 3 tags {blue,
   sky,cloud} and I want to filter by one of them for example SKY.
 * The plugin give me back “No images were found” because I need to filter by all
   of them.
 * Can I do that ?
 * Thanks and I’ll keep looking for an error !
 *  Thread Starter [jse4](https://wordpress.org/support/users/jse4/)
 * (@jse4)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/shortcode-doesnt-work-from-another-shortcode/#post-7597793)
 * There is no reason for doesn’t work, is exactly the same shortcode from admin
   editor as PHP Code…
 * I’m using my own shortcode for showing a form for filtering, in the same php 
   file I process the action and if everything ‘OK’ I call do_shortcode…
 * It sometimes give me the error that I said and sometime says ‘no images were 
   found’.
    I don’t know whats the cause..
 * thanks
 *  Plugin Contributor [photocrati](https://wordpress.org/support/users/photocrati/)
 * (@photocrati)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/shortcode-doesnt-work-from-another-shortcode/#post-7597829)
 * [@jse4](https://wordpress.org/support/users/jse4/) – Generally the “No images
   were found” message is rendered when there are no images with the specific tag
   you are using. The easiest test is to see if using the specific tag instead of
   the variable provides an image display.
 * Given that using the specific tags versus the variable does work in the context
   you are describing you may need to look at your custom code to insure that it
   is providing the data you are expecting.
 * There could also be other influencing factors going on as well with your site
   and it may be best to test this using as close to the benchmark of a default 
   WordPress Twenty series theme and NextGEN Gallery as possible.
 * Thanks!
 * – Cais.

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

The topic ‘Shortcode doesn't work from another shortcode’ is closed to new replies.

 * ![](https://ps.w.org/nextgen-gallery/assets/icon-256x256.png?rev=2083961)
 * [Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery](https://wordpress.org/plugins/nextgen-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nextgen-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nextgen-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/nextgen-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nextgen-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nextgen-gallery/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [photocrati](https://wordpress.org/support/users/photocrati/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/shortcode-doesnt-work-from-another-shortcode/#post-7597829)
 * Status: resolved