Using this plugin you can execute arbitrary PHP code using shortcodes in your posts, pages, comments, widgets and RSS feeds, just like manually defined shortcodes. The shortcodes and associated PHP code are defined using the settings of this plugin. It is possible to parse and use shortcode parameters and to use shortcode content. Defined shortcodes can be deleted and disabled.Advantages over other solutions:
- Your texts do not have to contain PHP code
- PHP code can be reused (by reusing the shortcode)
- All PHP code is organized at one place
- Syntax highlighting
- You can test your PHP code before using it
- Import/export of shortcode definitions
- For those concerned about security (hopefully everybody): only administrators can define shortcodes and associated PHP code (see also the FAQ).
Please report any issue you have with this plugin on the support page, so I can at least try to fix it. If you rate this plugin low, please let me know why.
- Login to your weblog
- Go to Plugins
- Select Add New
- Search forShortcode Exec PHP
- Select Install
- Select Install Now
- Select Activate Plugin
- Download and unzip the plugin
- Upload the entire shortcode-exec-php/ directory to the /wp-content/plugins/ directory
- Activate the plugin through the Plugins menu in WordPress
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 withmanage_options(single user) ormanage_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 thePHP eval functionis used, errors cannot be handled unfortunately, so test your code thoroughly.
How many shortcodes can I define?
I get a blank page when I use a shortcode on a large post/page
This can happen if thePCRE backtrackvalue is too low. Denver Used Cars . settlement loans . 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?
- Copyshortcode-exec-php.cssto your upload directory to prevent it from being overwritten by an update
- 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
Can I embed HTML code?
Yes, if you enclose the HTML code with
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 aglobal $wpdb;is needed to access thedatabase class. If I am around I am happy to help you with your code, see next question.
Downloaded 131 times