[memb_php]
Description
Executes arbitrary PHP code placed between the shortcode tags, or the
contents of a PHP file specified with the file attribute. Output is
returned in place of the shortcode, optionally post-processed.
Security: the shortcode requires a valid signature when the
content was signed. Code runs through the sandboxed evaluator
(torii_code_eval), which strips HTML tags outside quotes before
evaluation. Use with care, this shortcode executes code stored in
post content.
When file is used, a leading relative path is resolved against
ABSPATH, leading <?php and trailing ?> markers are stripped, and
the file's output becomes the shortcode output.
Shortcode Examples
Inline PHP:
[memb_php]echo 'Hello ' . date('Y');[/memb_php]
Include a file (relative to WordPress root or absolute):
[memb_php file="/var/www/scripts/report.php" postprocess="true"]
Shortcode Parameters
file
Path to a PHP file to include instead of inline content. Relative
paths resolve against ABSPATH. Default: ''.
postprocess
When truthy, shortcodes in the executed output are expanded.
Default: false.
signature
Security signature for validation. Default: ''.
before
Content prepended to the output. Default: ''.
after
Content appended to the output. Default: ''.
txtfmt
Text format applied to the output.
capture
Output capture mode.
htmlattr
HTML attribute wrapper for the output.
Shortcode Attributes
| Attribute | Value |
|---|---|
| Conditional | No |
| Nestable | No |
| Accepts formatting | Yes |