Overview
PHP Code Widget describes itself as: “Like the Text widget, but also allows working PHP code to be inserted.”
It is active on 70,000+ WordPress sites and rated 4.7 out of 5 by 61 users on WordPress.org. Developers can extend it through 0 actions and 2 filters, listed below.
How to install PHP Code Widget
- Open the plugin installer. In your WordPress dashboard go to Plugins → Add New Plugin.
- Search for it. Type “PHP Code Widget” and pick the one by Samuel Wood (Otto).
- Install and activate. Click Install Now, then Activate.
Install with a zip file or WP-CLI
Download the zip from the WordPress.org plugin page, then go to Plugins → Add New Plugin → Upload Plugin, choose the file and click Install Now. Or from the command line:
wp plugin install php-code-widget --activateRequirements: WordPress 2.8+ · tested up to WordPress 5.9.20
Hooks & customisation
PHP Code Widget 2.4 fires 0 actions and 2 filters. Use them from your child theme or a snippets plugin to change how it behaves without editing its files.
// Filter in execphp.php
apply_filters( 'widget_execphp', $instance['text'], $instance );
// Filter in execphp.php
apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance );Need PHP Code Widget customised?
Tell us what you want changed, added or fixed and we'll reply with an estimate.
WP EXPERTS is independent and not affiliated with Samuel Wood (Otto). Plugin names and logos belong to their owners. Version, rating and install figures from WordPress.org, checked Nov 17, 2026.