Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a hook for dynamic global replace text value? #172

Open
jure123 opened this issue Dec 3, 2023 · 0 comments
Open

Is there a hook for dynamic global replace text value? #172

jure123 opened this issue Dec 3, 2023 · 0 comments

Comments

@jure123
Copy link

jure123 commented Dec 3, 2023

I noticed that hooks are supported for Modify matches action, but not for Global text replace action (I think). It would be useful to have a hook to be called before replacing text that would support dynamic replacement text value.

For example, I need to search all shortcodes like [vc_single_image image=”6800″], where I need to extract the image ID using regex params. Then I need to replace the shortcode with <img src="/wp-content/2020/01/image.jpg" />, where image ID must be replace with actual image URL. In this case it would be helpful that Search Regex plugin would call some hook like apply_filters('before_replace_value, $searchRegexResult, $replaceValue, $match, ...), where I could read the image ID (from the search regex param), then programatically get the corresponding image URL, and return the custom replace value <img src="image-url.jpg" /> that Search Regex plugin will replace to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants