WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Shortcode Exec PHP

Execute arbitrary, reusable PHP code in posts, pages, comments, widgets and RSS feeds using shortcodes in a safe and easy way

Where can I define shortcodes?

WordPress menu Tools > Shortcode Exec PHP

What happens when I disable a shortcode?

The shortcode will not be handled and will appear unprocessed.

Who can access the settings and the PHP code?

Users with manage_options (single user) or manage_network (multi user) capability (administrators).

Who can use the defined shortcodes?

Anyone who can create or modify posts, pages and/or widgets or can write comments. Shortcode execution in widgets, excerpts, comments and RSS feeds is disabled by default (unless another plugin or your theme does enable it). It is possible to restrict shortcode execution in posts and pages based on the capabilities of the post or page author (since version 1.18).

How are PHP errors handled?

Because the PHP eval function is used, errors cannot be handled unfortunately, so test your code thoroughly.

How many shortcodes can I define?

Unlimited.

I get a blank page when I use a shortcode on a large post/page

This can happen if the PCRE backtrack value is too low. Try increasing it using the plugin settings.

Where are the shortcode definitions stored?

The shortcode name, options and PHP code are stored as WordPress options.

How can I change the styling of the settings?

  1. Copy shortcode-exec-php.css to your upload directory to prevent it from being overwritten by an update
  2. Change the style sheet to your wishes; the style sheet contains documentation

How do I test a shortcode with parameters?

Indirectly, by using default values.

Should I use PHP opening and closing tags?

No, omit both <?php and ?>.

Can I embed HTML code?

Yes, if you enclose the HTML code with ?> and <?.

My shortcode appears with a question mark behind it

The post or page author has insufficient privileges to execute shortcodes.

I get 'Warning: ... in ... : eval()’d code on line xxx'

This means there is an error in your shortcode definition on line xxx.

My code doesn't work!

Note that your code is not directly executed in the WordPress environment, but in a function. This means for example that a global $wpdb; is needed to access the database class.

Where can I ask questions, report bugs and request features?

This plugin is not supported anymore

Requires: 3.1 or higher
Compatible up to: 3.8.3
Last Updated: 2014-4-18
Downloads: 214,425

Ratings

4 stars
4.7 out of 5 stars

Support

2 of 4 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,1,1 100,1,1 100,1,1 100,1,1
100,1,1 100,1,1 100,1,1 100,1,1 100,1,1
100,1,1 100,1,1 100,1,1 100,1,1 100,1,1
100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,2,2 100,3,3
100,1,1
100,1,1 83,6,5 100,4,4 100,1,1 100,1,1 100,1,1 100,1,1 50,2,1 100,2,2
100,2,2
100,2,2
0,1,0
100,2,2 0,1,0 67,3,2 50,2,1 100,1,1
100,3,3 100,1,1
100,2,2 100,1,1
100,4,4 100,2,2
100,1,1
100,3,3
100,2,2 93,14,13 100,3,3 100,1,1 100,5,5 100,1,1 100,1,1
100,4,4 100,2,2
100,8,8 90,10,9 100,1,1 100,1,1
100,1,1 100,11,11
100,5,5 100,3,3
83,6,5
100,1,1
100,1,1
100,3,3
100,2,2
100,1,1
100,5,5
100,5,5