Title: PHP code not executed when logged out
Last modified: November 21, 2017

---

# PHP code not executed when logged out

 *  [cgdannie](https://wordpress.org/support/users/cgdannie/)
 * (@cgdannie)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/php-code-not-executed-when-logged-out/)
 * Hello,
 * thank you for your great plugin! But I have a little problem. I knwo, this has
   probably nothing to do with your plugin and I already asked [here](https://stackoverflow.com/questions/47277596/wordpress-elementor-php-code-widget-php-code-is-not-execute-and-everything-afte),
   but maybe you can yet help me.
 * When I paste the following code
 *     ```
       <?php
           echo 'before';
           $someArray = ['foo' => 'bar'];
           echo 'after';
       ?>
       <b>some HTML</b>
       ```
   
 * into your widget inside the [Elementor PageBuilder](https://elementor.com/), 
   everything works fine and returns
 *     ```
       beforeafter
       ```
   
 * as long as I am logged in (even with an account, that has only the author role).
 * When I am logged out, the PHP code is not executed and the following is printed
   on the site:
 *     ```
       'bar']; echo 'after'; ?>
       ```
   
 * The HTML is rendered fine.
 * If I paste the same code into a widget outisde of Elementor, everything also 
   works fine.
 * Do you have any ideas how to solve this issue? Thank you very much!

Viewing 1 replies (of 1 total)

 *  Plugin Author [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [8 years, 4 months ago](https://wordpress.org/support/topic/php-code-not-executed-when-logged-out/#post-9757456)
 * No idea how to solve that. Sounds like something Elementor is doing, such that
   it is interpreting the < … > as an HTML tag.
 * Sorry, ask Elementor.

Viewing 1 replies (of 1 total)

The topic ‘PHP code not executed when logged out’ is closed to new replies.

 * ![](https://ps.w.org/php-code-widget/assets/icon.svg?rev=992095)
 * [PHP Code Widget](https://wordpress.org/plugins/php-code-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/php-code-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/php-code-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/php-code-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/php-code-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/php-code-widget/reviews/)

## Tags

 * [logged out](https://wordpress.org/support/topic-tag/logged-out/)

 * 1 reply
 * 2 participants
 * Last reply from: [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/php-code-not-executed-when-logged-out/#post-9757456)
 * Status: not resolved