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

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.

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. If I am around I am happy to help you with your code, see next question.

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

You can write a comment in the the forum.

Requires: 3.1 or higher
Compatible up to: 3.3.2
Last Updated: 2012-5-13
Downloads: 89,341

Average Rating

4 stars
(78 ratings)

Support

0 of 0 support threads in the last three weeks have been resolved.

Got something to say? Need help?

Compatibility

+
=
Works!

9 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,9,9