Title: Executing PHP when in edit mode
Last modified: June 8, 2019

---

# Executing PHP when in edit mode

 *  Resolved [Terry J](https://wordpress.org/support/users/texasbiz/)
 * (@texasbiz)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/executing-php-when-in-edit-mode/)
 * Greetings. Been using PHP Everywhere for some time without any issues, thank 
   you for bring it here to us!
 * I finally gave in and started using the Gutenberg Editor for new site(s). Using
   Gutenberg along with new plugin “Grids: Layout builder for WordPress”.
 * The issue I am experiencing is my PHP code placed in PHP Everywhere is being 
   executed even when trying to edit the page. Never experienced this before so 
   thinking maybe related to Gutenberg Editor?
 * Is this something that is known to happen?
 * Thanks!
    -  This topic was modified 6 years, 11 months ago by [Terry J](https://wordpress.org/support/users/texasbiz/).

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

 *  Thread Starter [Terry J](https://wordpress.org/support/users/texasbiz/)
 * (@texasbiz)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/executing-php-when-in-edit-mode/#post-11624530)
 * After seeing support questions unanswered for couple of weeks, assuming plugin
   is dead on support and development. Really sad as excellent plugin.
 *  Plugin Author [Alex](https://wordpress.org/support/users/alexander_fuchs/)
 * (@alexander_fuchs)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/executing-php-when-in-edit-mode/#post-11624995)
 * Hi Terry,
 * I maintain this plugin in my free time. Therefore, I may not always have time
   to reply to support tickets.
 * Anyhow, this plugin is still in active development and all bug reports are noted.
   However, I can not reply to all of them (mutiple a day).
 *  Thread Starter [Terry J](https://wordpress.org/support/users/texasbiz/)
 * (@texasbiz)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/executing-php-when-in-edit-mode/#post-11626358)
 * > I maintain this plugin in my free time. Therefore, I may not always have time
   > to reply to support tickets.
 * I totally understand and respect that Alexander. Also appreciate you sharing 
   the plugin with us. Guess was just frustrated as see so many great plugins come
   and go, hated to think PHP Everywhere would be one of those:)
 * Thank you for the update.
 *  Plugin Author [Alex](https://wordpress.org/support/users/alexander_fuchs/)
 * (@alexander_fuchs)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/executing-php-when-in-edit-mode/#post-11626759)
 * Hi Terry, always appreciated.
 * Could you send me a screenshot of the page where the code gets executed in the
   editor? I was trying to reproduce the problem and was not able to reproduce it.
 * Thanks!
 * Alex
 *  Thread Starter [Terry J](https://wordpress.org/support/users/texasbiz/)
 * (@texasbiz)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/executing-php-when-in-edit-mode/#post-11627580)
 * Hi Alexander. Unfortunately I have removed the plugin and moved on to another
   for that specific site.
 * I was using the following:
 * Theme: Page Builder Framework ([https://wordpress.org/themes/page-builder-framework/](https://wordpress.org/themes/page-builder-framework/))
   
   Related Theme Plugin: Grids ([https://wordpress.org/plugins/grids/](https://wordpress.org/plugins/grids/))
   PHP 7.2 Latest WP release
 * The PHP was simple:
 *     ```
       if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false))
       {
       $newlocation = 'somepage.php';
       }
       else {
       die();
       }
       ```
   
 * I say page was executing PHP because when trying to edit, page would be blank
   and assumed that was because of the die() statement.
 * Be doing another site in coming weeks and if it happens, will take some screenshots.
 *  Thread Starter [Terry J](https://wordpress.org/support/users/texasbiz/)
 * (@texasbiz)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/executing-php-when-in-edit-mode/#post-11822810)
 * I really think the execution of php code when trying to edit in admin mode should
   not happen at all. Do not know how to fix, but real pain in rear:)
 * If anyone has any ideas, open to hear them cause really like to use this plugin.
 *  [janenef](https://wordpress.org/support/users/janenef/)
 * (@janenef)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/executing-php-when-in-edit-mode/#post-11892238)
 * I think that I am having the same issue. When I try to open a page for editing,
   I receive the following “The site is experiencing technical difficulties. Please
   check your site admin email inbox for instructions.” When I go into the site 
   in Recovery Mode, php anywhere is deactivated for the following reason “An error
   of type E_COMPILE_ERROR was caused in line 2 of the file /xxxxx/xxxxx/public_html/
   wp-content/plugins/php-everywhere/shortcode.php(15) : eval()’d code. Error message:
   require(): Failed opening required ‘app/php/bootstrap.php’ (include_path=’.:/
   opt/cpanel/ea-php73/root/usr/share/pear’)”. My site is still working perfectly.
   But it is impossible to add/update any pages. I am running WordPress 5.2.2.
 * I have this site running on my laptop (as localhost) using WordPress 4.9.10 and
   it works perfectly.
 *  Thread Starter [Terry J](https://wordpress.org/support/users/texasbiz/)
 * (@texasbiz)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/executing-php-when-in-edit-mode/#post-11892292)
 * Yes, I continue to experience many issues. I have found that on admin pages where
   I am using PHP Everywhere, leave the editor in text mode.
 * If you visit admin page with blocks / classic editor active, PHP executes. If
   in text mode it does not and you can edit page as normal…
 *  [bobjgarrett](https://wordpress.org/support/users/bobjgarrett/)
 * (@bobjgarrett)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/executing-php-when-in-edit-mode/#post-12258591)
 * I have the same problem.
    Any solution?
 *  [bobjgarrett](https://wordpress.org/support/users/bobjgarrett/)
 * (@bobjgarrett)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/executing-php-when-in-edit-mode/#post-12333333)
 * okay, you can show this problem using the following code within a php-everywhere
   block.
 * <?php
    /* now wait 5 seconds and redirect*/ header( “refresh:5; url=http://www.
   google.co.uk” ); ?> Moves on after 5 secs
 * Save the page and close it.
    Then reopen the page for editing. Wait 5 secs and
   it moves on to the search page.

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

The topic ‘Executing PHP when in edit mode’ is closed to new replies.

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

 * 10 replies
 * 1 participant
 * Last reply from: [bobjgarrett](https://wordpress.org/support/users/bobjgarrett/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/executing-php-when-in-edit-mode/#post-12333333)
 * Status: resolved