Title: shortcode used php code
Last modified: May 11, 2021

---

# shortcode used php code

 *  [channel856](https://wordpress.org/support/users/channel856/)
 * (@channel856)
 * [5 years ago](https://wordpress.org/support/topic/shortcode-used-php-code/)
 * Hi! Thanks for your great job!
 * Can you please give some advice how to check any shortcode exist in php way?
 * For example I need to load some extra js in head section if any shortcode is 
   used onpage.

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

 *  Plugin Author [vaakash](https://wordpress.org/support/users/vaakash/)
 * (@vaakash)
 * [5 years ago](https://wordpress.org/support/topic/shortcode-used-php-code/#post-14431824)
 * Hi [@channel856](https://wordpress.org/support/users/channel856/),
 * Thanks for using Shortcoder.
 * I’m afraid that won’t be possible. It is not possible to predict what shortcodes
   will be used in a page, since page is loaded linearly from top to bottom.
 * This looks like something beyond the plugin’s scope.
 * My suggestion would be hardcode the condition on where the script has to be loaded
   in the header.
 * Thanks,
    Aakash
 *  Thread Starter [channel856](https://wordpress.org/support/users/channel856/)
 * (@channel856)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/shortcode-used-php-code/#post-14583551)
 * Hi! Thanks for your answer and sorry for long delay.
 * Actually I need to load additional js-script in the head section of any page 
   where some shortcode is used.
 * Is it possible for now or can you add this great feature to future versions?
 *  Plugin Author [vaakash](https://wordpress.org/support/users/vaakash/)
 * (@vaakash)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/shortcode-used-php-code/#post-14585067)
 * Hi [@channel856](https://wordpress.org/support/users/channel856/),
 * Right now this feature is not possible. This is something which needs special
   implementation because we cannot look ahead if a shortcode is used on a page 
   and insert scripts in the header.
 * I do have this in my todo list. But I cannot promise any time for this feature.
   For now I can suggest some other plugins like “header and footer” scripts for
   the same.
    Hope you understand.
 * Thanks,
    Aakash

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

The topic ‘shortcode used php code’ is closed to new replies.

 * ![](https://ps.w.org/shortcoder/assets/icon.svg?rev=2222236)
 * [Shortcoder — Create Shortcodes for Anything](https://wordpress.org/plugins/shortcoder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortcoder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortcoder/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcoder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcoder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcoder/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [vaakash](https://wordpress.org/support/users/vaakash/)
 * Last activity: [4 years, 11 months ago](https://wordpress.org/support/topic/shortcode-used-php-code/#post-14585067)
 * Status: not a support question