Title: Use parameters in shortcode?
Last modified: August 30, 2016

---

# Use parameters in shortcode?

 *  Resolved [Accountteam](https://wordpress.org/support/users/accountteam/)
 * (@accountteam)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/use-parameters-in-shortcode/)
 * Is this possible?
 * What I am trying to achieve is e.g. [my_shortcode vara=”A” varb=”B”] in a post
   or page and then (underwater) execute this PHP-script:
 * <?php
    echo $varA; echo $varB; ?>
 * But I don’t know how to translate the parameters vara and varb to variables.
 * [https://wordpress.org/plugins/shortcode-exec-php/](https://wordpress.org/plugins/shortcode-exec-php/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [Accountteam](https://wordpress.org/support/users/accountteam/)
 * (@accountteam)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/use-parameters-in-shortcode/#post-6472683)
 * Found it : [https://codex.wordpress.org/Shortcode_API](https://codex.wordpress.org/Shortcode_API)
 * Apparently all I had to do was:
 * [test categorie=”een” aantal=”twee”]
 * <?php
    extract(shortcode_atts(array(‘categorie’ => ‘1’, ‘aantal’ => ‘2’), $atts));
   echo “categorie”. $categorie .”“; echo “aantal”. $aantal .”“; ?>
 * I tried this, but the plugin itself has some caching issue. Deleting the shortcode
   and creating it again solved it.

Viewing 1 replies (of 1 total)

The topic ‘Use parameters in shortcode?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/shortcode-exec-php.svg)
 * [Shortcode Exec PHP](https://wordpress.org/plugins/shortcode-exec-php/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortcode-exec-php/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortcode-exec-php/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcode-exec-php/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcode-exec-php/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcode-exec-php/reviews/)

## Tags

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

 * 1 reply
 * 1 participant
 * Last reply from: [Accountteam](https://wordpress.org/support/users/accountteam/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/use-parameters-in-shortcode/#post-6472683)
 * Status: resolved