Replace from URL
Fill a displayed string with URL parameters
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/d-damien/wp-replace-from-url/archive/refs/heads/master.zipFill a displayed string with URL parameters.
Description
Here is the use-case I had in mind when building this. You want to display a series of forms (with an "id" parameter in their URL) in an iframe, but they are too big and would need their own page. But you also want this page to be part of the site to have the WP menus still available.
Assuming your forms are at https://abc.com/forms/{id}/show, here is how you could use the shortcode :
[replace_fromurl str='' params='{"id": "\d+"}' prefix='rfu']
If you reach the page https://mysite.com/myforms?rfu_id=556
This will display :
Parameters
- str : The parameterized string (possibly HTML) you want to have filled. Parameters must be enclosed like {this}.
- params : Serialized JSON object with key = param name, and value = validation regex. Have something as constrained as possible for security, such as \d+ or \w+. Make sure to escape backslashes.
- prefix : To avoid conflicting with other page parameters, a prefix is possible. For example with "rfu_", your page then needs to be reached with https://mysite.com/myforms?rfu_id=556 etc
Changelog
0.1.0
- Init features with configurable param names & regex, and prefix to avoid namespace collisions.