Title: PHP Code Widget
Author: Samuel Wood (Otto)
Published: <strong>20 ມີນາ 2008</strong>
Last modified: 30 ມີນາ 2022

---

ຄົ້ນຫາປລັກອິນ

ປລັກອິນນີ້ **ຍັງບໍ່ທັນໄດ້ຮັບການທົດສອບກັບ WordPress 3 ເວີຊັນຫຼັກຫຼ້າສຸດ**. ມັນອາດຈະ
ບໍ່ໄດ້ຮັບການເບິ່ງແຍງ ຫຼື ສະໜັບສະໜູນອີກຕໍ່ໄປ ແລະ ອາດມີບັນຫາການເຮັດວຽກຮ່ວມກັນເມື່ອ
ໃຊ້ກັບ WordPress ເວີຊັນທີ່ໃໝ່ກວ່າ.

![](https://ps.w.org/php-code-widget/assets/icon.svg?rev=992095)

# PHP Code Widget

 ໂດຍ [Samuel Wood (Otto)](https://profiles.wordpress.org/otto42/)

[ດາວໂຫຼດ](https://downloads.wordpress.org/plugin/php-code-widget.2.4.zip)

 * [ລາຍລອຽດ](https://lo.wordpress.org/plugins/php-code-widget/#description)
 * [ການຣີວິວ](https://lo.wordpress.org/plugins/php-code-widget/#reviews)
 * [ການພັດທະນາ](https://lo.wordpress.org/plugins/php-code-widget/#developers)

 [ການຊ່ວຍເຫຼືອ](https://wordpress.org/support/plugin/php-code-widget/)

## ຄຳອະທິບາຍ

The normal Text widget allows you to insert arbitrary Text and/or HTML code. This
allows that too, but also parses any PHP code in the text widget and executes it.

This can make it easier to migrate to a widget-based theme. However, this plugin
should not be used long term, as anybody with access to edit the widgets on your
site will be able to execute arbitrary PHP code.

All PHP code must be enclosed in the standard php opening and closing tags ( `<?
php` and `?>` ) for it to be recognized and executed.

Only users with the unfiltered_html role will be allowed to insert unfiltered HTML.
This includes PHP code, so users without admin or editor permissions will not be
able to use this to execute code, even if they have widget editing permissions.

## ພາບໜ້າຈໍ

 * [[
 * The widgets screen showing a PHP code widget in use.
 * [[
 * The output of the widget on the site.

## ຄຳຖາມທີ່ພົບເລື້ອຍ

### There’s some kind of error on line 27!

That error means that your PHP code is incorrect or otherwise broken.

### But my code is fine!

No, it’s not. Really.

This widget has no real errors in it, it’s about the simplest widget one can possibly
make. Any errors coming out of the “execphp.php” file are errors in code you put
into one of the widgets. The reason that it shows the error being in the execphp.
php file is because that is where your widget’s code is actually being run.

So, if it says that you have an error on line 27, I assure you, the problem is yours.
Please don’t email me about that error.

### I have code that works normally in a template but doesn’t work when in the widget?

Code in a template runs in the global context. Code in the widget will run in a 
function context. Make sure that you declare any global variables as global before
attempting to use them.

## ການຣີວິວ

![](https://secure.gravatar.com/avatar/9038fefd4186ca83516f213a9f8a94fac14c784244d7018c6bad9752e4e6eb92?
s=60&d=retro&r=g)

### 󠀁[Excellent, awesome // incredible plug in!!](https://wordpress.org/support/topic/excellent-awesome-incredible-plug-in-3/)󠁿

 [dglite](https://profiles.wordpress.org/dglite/) 25 ກໍລະກົດ 2022

Excellent, awesome // incredible plug in!!

![](https://secure.gravatar.com/avatar/316b97c42f06c926e44fe909cbcadbe917f4fe9203aa83309d34c2c83b8a3b25?
s=60&d=retro&r=g)

### 󠀁[Perfect](https://wordpress.org/support/topic/perfect-7386/)󠁿

 [holby](https://profiles.wordpress.org/holby/) 21 ມິຖຸນາ 2020

keep it going please

![](https://secure.gravatar.com/avatar/b1c2ef57cd65eaa885ec126438be4e135eb64b005708735defccd75609de61fe?
s=60&d=retro&r=g)

### 󠀁[much better solutions](https://wordpress.org/support/topic/much-better-solutions/)󠁿

 [Pexle Chris](https://profiles.wordpress.org/pexlechris/) 6 ມິຖຸນາ 2020

No highlighting for snippets.Support also doesn’t exists. You can find much better
plugins to insert php code snippets

![](https://secure.gravatar.com/avatar/ec1adb6fe0eff07e1ca0feec0acc43026f0b2f3c1130bb9fa61317bf901b4fc3?
s=60&d=retro&r=g)

### 󠀁[Very useful](https://wordpress.org/support/topic/very-useful-2142/)󠁿

 [Nester](https://profiles.wordpress.org/hobbyits/) 3 ກຸມພາ 2020

A very useful widget. Especially in emergency situations when there is no time to
write your own solution for your task.

![](https://secure.gravatar.com/avatar/e3ce6fce3bb0cef4ab2209a0d0d12821788c37ec6dbd8d0e243052821e76ba13?
s=60&d=retro&r=g)

### 󠀁[Awesome Plugin](https://wordpress.org/support/topic/awesome-plugin-4525/)󠁿

 [Xaib Aslam](https://profiles.wordpress.org/lahorimela/) 20 ກັນຍາ 2019 1 ການຕອບ
ກັບ

I was trying to find the updated plugin for PHP and at last I found this, because
they update there plugin regularly. So I must say to enjoy this plugin.

![](https://secure.gravatar.com/avatar/d249480e163b77db7cd2597c9b63b91b87df3ad709933dcbccc70bc6858725c0?
s=60&d=retro&r=g)

### 󠀁[Выполняет свою задачу](https://wordpress.org/support/topic/%d0%b2%d1%8b%d0%bf%d0%be%d0%bb%d0%bd%d1%8f%d0%b5%d1%82-%d1%81%d0%b2%d0%be%d1%8e-%d0%b7%d0%b0%d0%b4%d0%b0%d1%87%d1%83/)󠁿

 [kotyarashop](https://profiles.wordpress.org/kotyarashop/) 5 ກັນຍາ 2019

Выполняет свою задачу

 [ ອ່ານການຣີວິວທັງໝົດ 65 ລາຍການ ](https://wordpress.org/support/plugin/php-code-widget/reviews/)

## ຜູ້ຮ່ວມພັດທະນາ ແລະ ຜູ້ພັດທະນາ

“PHP Code Widget” ແມ່ນຊອຟແວໂອເພັນຊອດ (Open Source). ບຸກຄົນຕໍ່ໄປນີ້ໄດ້ມີສ່ວນຮ່ວມໃນ
ການພັດທະນາປລັກອິນນີ້.

ຜູ້ຮ່ວມພັດທະນາ

 *   [ Samuel Wood (Otto) ](https://profiles.wordpress.org/otto42/)

“PHP Code Widget” ໄດ້ຖືກແປເປັນ 25 ພາສາທ້ອງຖິ່ນ. ຂໍຂອບໃຈ [ທີມງານຜູ້ແປ](https://translate.wordpress.org/projects/wp-plugins/php-code-widget/contributors)
ສຳລັບການປະກອບສ່ວນຂອງເຂົາເຈົ້າ.

[ແປ “PHP Code Widget” ເປັນພາສາຂອງເຈົ້າ.](https://translate.wordpress.org/projects/wp-plugins/php-code-widget)

### ສົນໃຈຮ່ວມພັດທະນາບໍ່?

[ເບິ່ງລະຫັດ](https://plugins.trac.wordpress.org/browser/php-code-widget/), ກວດເບິ່ງ
[ຄັງເກັບ SVN](https://plugins.svn.wordpress.org/php-code-widget/), ຫຼື ຕິດຕາມ [ບັນທຶກການພັດທະນາ](https://plugins.trac.wordpress.org/log/php-code-widget/)
ຜ່ານ [RSS](https://plugins.trac.wordpress.org/log/php-code-widget/?limit=100&mode=stop_on_copy&format=rss).

## ບັນທຶກການປ່ຽນແປງ

#### 2.4

 * After much demand, made it stop throwing a warning in PHP 8. Please consider 
   ceasing usage of this widget on modern sites. Switch to block based themes, or
   use purpose specific plugins to solve your needs instead of storing PHP code 
   in the database.

#### 2.3

 * Changed the call to WP_Widget to use the PHP 5 __construct() method. Ref: https://
   make.wordpress.org/core/2015/07/02/deprecating-php4-style-constructors-in-wordpress-
   4-3/

#### 2.2

 * Translation fixes for WP 3.7
 * Remove donation link

#### 2.1

 * Fixed broken wpautop filter. Checkbox on widget works now.

#### 2.0

 * Changed widget to use new Class methods for creating widget. This simplifies 
   the widget and should eliminate any problems with it losing code or disappearing
   from sidebars and so forth.

## ຂໍ້ມູນກຳກັບ (Meta)

 *  ເວີຊັນ **2.4**
 *  ອັບເດດຫຼ້າສຸດເມື່ອ **4 ປີ ທີ່ຜ່ານມາ** ທີ່ຜ່ານມາ
 *  ການຕິດຕັ້ງທີ່ໃຊ້ງານຢູ່ **80,000+**
 *  ເວີຊັນ WordPress ** 2.8 ຫຼື ສູງກວ່າ **
 *  ທົດສອບເຖິງເວີຊັນ **5.9.13**
 *  ພາສາ
 * [Catalan](https://ca.wordpress.org/plugins/php-code-widget/), [Chinese (China)](https://cn.wordpress.org/plugins/php-code-widget/),
   [Czech](https://cs.wordpress.org/plugins/php-code-widget/), [Dutch](https://nl.wordpress.org/plugins/php-code-widget/),
   [Dutch (Belgium)](https://nl-be.wordpress.org/plugins/php-code-widget/), [English (Australia)](https://en-au.wordpress.org/plugins/php-code-widget/),
   [English (Canada)](https://en-ca.wordpress.org/plugins/php-code-widget/), [English (South Africa)](https://en-za.wordpress.org/plugins/php-code-widget/),
   [English (UK)](https://en-gb.wordpress.org/plugins/php-code-widget/), [English (US)](https://wordpress.org/plugins/php-code-widget/),
   [French (Canada)](https://fr-ca.wordpress.org/plugins/php-code-widget/), [French (France)](https://fr.wordpress.org/plugins/php-code-widget/),
   [Galician](https://gl.wordpress.org/plugins/php-code-widget/), [German](https://de.wordpress.org/plugins/php-code-widget/),
   [Italian](https://it.wordpress.org/plugins/php-code-widget/), [Japanese](https://ja.wordpress.org/plugins/php-code-widget/),
   [Lithuanian](https://lt.wordpress.org/plugins/php-code-widget/), [Marathi](https://mr.wordpress.org/plugins/php-code-widget/),
   [Portuguese (Portugal)](https://pt.wordpress.org/plugins/php-code-widget/), [Russian](https://ru.wordpress.org/plugins/php-code-widget/),
   [Spanish (Chile)](https://cl.wordpress.org/plugins/php-code-widget/), [Spanish (Spain)](https://es.wordpress.org/plugins/php-code-widget/),
   [Spanish (Venezuela)](https://ve.wordpress.org/plugins/php-code-widget/), [Swedish](https://sv.wordpress.org/plugins/php-code-widget/),
   [Turkish](https://tr.wordpress.org/plugins/php-code-widget/), ແລະ [Ukrainian](https://uk.wordpress.org/plugins/php-code-widget/).
 *  [ແປເປັນພາສາຂອງເຈົ້າ](https://translate.wordpress.org/projects/wp-plugins/php-code-widget)
 * ແທັກ
 * [php](https://lo.wordpress.org/plugins/tags/php/)[widget](https://lo.wordpress.org/plugins/tags/widget/)
 *  [ມຸມມອງຂັ້ນສູງ](https://lo.wordpress.org/plugins/php-code-widget/advanced/)

## ການໃຫ້ຄະແນນ

 4.7 ຈາກທັງໝົດ 5 ດາວ.

 *  [  ການວິຈານ 5 ດາວ ຈຳນວນ 52 ລາຍການ     ](https://wordpress.org/support/plugin/php-code-widget/reviews/?filter=5)
 *  [  ການວິຈານ 4 ດາວ ຈຳນວນ 5 ລາຍການ     ](https://wordpress.org/support/plugin/php-code-widget/reviews/?filter=4)
 *  [  ການວິຈານ 3 ດາວ ຈຳນວນ 1 ລາຍການ     ](https://wordpress.org/support/plugin/php-code-widget/reviews/?filter=3)
 *  [  ການວິຈານ 2 ດາວ ຈຳນວນ 0 ລາຍການ     ](https://wordpress.org/support/plugin/php-code-widget/reviews/?filter=2)
 *  [  ການວິຈານ 1 ດາວ ຈຳນວນ 3 ລາຍການ     ](https://wordpress.org/support/plugin/php-code-widget/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/php-code-widget/reviews/#new-post)

[ເບິ່ງ ຄຳຄິດເຫັນ ທັງໝົດ](https://wordpress.org/support/plugin/php-code-widget/reviews/)

## ຜູ້ຮ່ວມພັດທະນາ

 *   [ Samuel Wood (Otto) ](https://profiles.wordpress.org/otto42/)

## ການຊ່ວຍເຫຼືອ

ມີຄຳຖາມ ຫຼື ຕ້ອງການຄວາມຊ່ວຍເຫຼືອບໍ່?

 [ເບິ່ງຟໍຣັມການຊ່ວຍເຫຼືອ](https://wordpress.org/support/plugin/php-code-widget/)