Title: php in shortcode
Last modified: June 28, 2023

---

# php in shortcode

 *  Resolved [pierremaitre](https://wordpress.org/support/users/pierremaitre/)
 * (@pierremaitre)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/php-in-shortcode-2/)
 * Hi there,
 * Thank you for this nice plugin.
 * I would like to be able to insert some php code into a kaya shortcode. My specific
   need is to dynamically display the post title
 * I tried something like :
 *     ```wp-block-code
       <?php echo do_shortcode( '[kaya_qrcode content="echo the_permalink();"]' ); ?>
       ```
   
 * But it does not work…
 * Any solution?
 * Thanks

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

 *  Thread Starter [pierremaitre](https://wordpress.org/support/users/pierremaitre/)
 * (@pierremaitre)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/php-in-shortcode-2/#post-16856576)
 * I answer to myself, this code works:
 *     ```wp-block-code
       <?php echo do_shortcode('[kaya_qrcode content="' . get_permalink() . '"]'); ?>
       ```
   
 *  Plugin Author [Kaya Studio](https://wordpress.org/support/users/kayastudio/)
 * (@kayastudio)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/php-in-shortcode-2/#post-16858298)
 * Hello,
   Thank you for your comment and for using ‘Kaya QR Code Generator’.
 * Indeed, your first snippet was wrong because it did not contain the concatenation
   between “get_permalink()” and the string, and also had an extra semicolon.
 * I’m glad that you resolved your issue.
 * I set the topic as resolved.
 * Best regards.

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

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

 * ![](https://ps.w.org/kaya-qr-code-generator/assets/icon-256x256.png?rev=2203917)
 * [Kaya QR Code Generator](https://wordpress.org/plugins/kaya-qr-code-generator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/kaya-qr-code-generator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/kaya-qr-code-generator/)
 * [Active Topics](https://wordpress.org/support/plugin/kaya-qr-code-generator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/kaya-qr-code-generator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/kaya-qr-code-generator/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Kaya Studio](https://wordpress.org/support/users/kayastudio/)
 * Last activity: [2 years, 11 months ago](https://wordpress.org/support/topic/php-in-shortcode-2/#post-16858298)
 * Status: resolved