wp_replace_shortcode
Replace a specific shortcode on a WordPress page with new content. Optionally filter by attribute and preview changes before applying.
Instructions
Find a specific shortcode in a page and replace it with new content. Optionally match an attribute value.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tag | Yes | Shortcode tag to find | |
| dry_run | No | Preview changes without writing | |
| page_id | Yes | Page ID | |
| match_attr | No | Attribute used to disambiguate | |
| occurrence | No | Zero-based occurrence after tag/attribute filtering | |
| match_value | No | Required substring in the attribute | |
| new_shortcode | Yes | Full replacement shortcode string |