on-internet
← Community

Wordpress/Elementor/PHP Code Widget: PHP code is not execute and everything after "=>" renders as plain text when I am logged out

Stack Overflow ·

I want to execute some PHP code in an WordPress Elementor template with the PHP Code Widget. Everything works fine as long as I am logged in. If I log out, the code is not executed and everything after "=>" shows as plain text. So e.g. the code <?php echo 'before'; $someArray = ['foo' => 'bar']; echo 'after'; ?> <b>some HTML</b> would result in the following string: 'bar']; echo 'after'; ?> The HTML after this is fine. If I place the same code in another widget outside of Elementor (e.g. the footer of the theme), everything also works fine. I am the admin of this single WordPress installation.

Comments

Sign in or sign up to comment and upvote.

No comments yet.