简体   繁体   中英

My php code is keep getting disable in wordpress editor after upgraded into latest version

My website had a older version of wordpress. Recently I upgraded it to the latest version. After that my php code what I write in the editor is keep getting disabled.

The old page which has php code in ti still works. Although in the editor the php codes are disabled. But if I try to save that it stops working. So i cannot update those page. And also I cannot create new page with php code in it

Exec-PHP plugin is installed.

If I write

<?php echo $c; ?>

It converts into

<!--?php echo $c; ?-->

How to fix that

attached image for better understanding.

在此处输入图片说明

Another way, which I don't quite recommend, is to follow this direction:

https://wordpress.org/support/topic/exec-php-to-work-in-php-7-needs-this/

This is basically updating the actual plugin, which will surely be overwritten by their next update.

This plugin requires a number of changes to work with php 7.

In exec-php.php

$GLOBALS[‘g_execphp_manager’] =& new ExecPhp_Manager();

must be changed to

$GLOBALS[‘g_execphp_manager’] = new ExecPhp_Manager();

In includes/manager.php from line 36 change each =& to =

In includes/admin.php lines 53,56,57,63,64,79 change =& to =

In includes/cache.php line 22,39 change =& to =

In includes/ajax.php line 64 change =& to =

I don't know about the plugin you use for this. However, I use xyzscripts for the same cause. It creates short-codes for me to use.

Here is an example:

  1. Create your PHP code and get a Tracking Name. PHP编辑器

  2. You will then get your short-code as below, note the Tracking Name. 简码清单

I personally think this is the best way as it allows re-usability and centralized location to update all your scripts.

XYZ WP PHP Code Download and Documentation

Thank you all for responding.

Apparently I find the solution by installing the Classic Editor plugin

https://en-gb.wordpress.org/plugins/classic-editor/

It prevents disabling the php code.

If you are facing similar problem you can try this one

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM