This belongs to stackoverflow. Here’s a solution anyway:
$content = preg_replace_callback('/\%replaceContent:{(.*?)}\%/', 'do_replacements', $content);
function do_replacements($matches){
$type = $matches[1]; // here's your {type}
$replacement = "...replacement for {$type}";
return $replacement;
}
Related Posts:
- How to create an API for my plugin?
- Is it ever okay to include inline CSS in plugins?
- Plugins in symlinked directories?
- In Which Contexts are Plugins Responsible for Data Validation/Sanitization?
- Best way to abort plugin in case of insufficient PHP version?
- How can I configure Docker for developing and deploying a custom theme?
- What do you think about custom designed plugin/theme options UIs?
- No Error Log File, no debug info
- Is the new WordPress 3.1 admin bar pluggable and how can I extend it?
- How to use PanelColorSettings in custom Gutenberg block?
- Getting a peer review for my new plugin?
- Optimize shortcode callbacks
- Using filters and actions for plugin API?
- How to Change the Entire WordPress Admin panel Look and Feel?
- Which to use to execute code during the saving of a plugin settings page?
- Allowing for multiple template views on the Gallery Settings page when using the Visual Editor
- Using Primary Color in Plugin Block
- When is it appropriate to put functions on page template vs. functions.php?
- How to create custom home page via plugin?
- Sessions not creating correctly in custom function
- Featured Image not showing in admin
- How to use wp_set_password in a plugin?
- Adding Automatically To In WordPress Using Filter Referencing?
- Delete a specific item menu when I deactivate my plugin
- Are we allowed to use the Allman (BSD) indent style when coding WordPress plugins and themes?
- Processing shortcodes in groups (separated by line breaks)?
- Get the password key when using the wp_new_user_notification_email filter
- Finding the paragraphs in content
- Order properties should not be accessed directly
- How to deal with equal & similar arguments for a function?
- Executing a function upon webhook calling wordpress
- Customizer: widget-synced triggers twice
- WordPress not working on localhost
- Adding functions to hooks from within a class
- how to use hook deleted_user into custom function to delete user from custom table
- Disable The Events Calendar plugin from loading its scripts
- Where to store the name of a custom table?
- WordPress is automatically linking plain text email addresses
- Is Using WordPress Supplied WYSIWYG Advisable?
- ServerSideRender and Media Object: attributes passing image data object to php renderer even though it’s not set
- Clearing caches on plugin uninstall
- How to use a hook to override an update_post_meta call in a plugin?
- Add code inside specific wordpress standard function
- Custom Taxonomy to dropdown box on adminside wordpress
- How to modify the comments to be displayed in a post?
- How can we display product price $104 on the cart while the credit card payment method is checked?
- How to modify files inside wp-includes directory in wordpress
- How should I go about registering JavaScript that isn’t a file? [duplicate]
- How to set a cookie for logged in users to md5($user->ID . “my_secret”)?
- Show message from backend
- Why in this archive page that call query_posts() function show only the last 10 posts?
- Create Widget or Enable Shortcodes in Sidebar
- how to save wp_editor html content in options table
- Adding Custom CSS with PHP
- How to use a WP_Customize_Control outside of the Customizer?
- How to remove/replace current page template?
- How to determine which capability to use?
- Customise Grouped Product display in Woocommerce with custom column
- Custom Endpoint – Does it possible to use PUT method with WP API Rest?
- Why won’t this submenu page show? – My First WordPress Plugin
- How to show content in the body with my plugin (only in frontend not backend)?
- Metabox types list
- Where to save Gutenberg plugin data?
- WordPress how do I echo SUM from a column of a MySQL table by user id AND type_operation
- WordPress Own Rewrite Rules
- Rate limiting ajax requests in WordPress
- Does hooking into a plugin action / filter override the plugin’s function for that hook?
- How to prevent users from deleting their accounts?
- How do I get a reference to the HTML memory buffer while the page is being constructed?
- Hiding class namespace from plugin’s extensions
- Set widget icon in Customizer?
- Determine if the current page, is being edited
- WordPress delete mysql rows with string
- external Integration with wordpress timeout error
- Add function to Dokan ajax class
- PHP includes with AJAX actions
- preg_replace style attr in $content and Editing post_content before saving
- Making adding info to an overlay bio easy for average user?
- Implementing Select2 plugin into WordPress
- Custom Post Type and Functions
- Associating special meaning with user id 0
- Can I access WordPress API’s from within plugin scripts?
- Theming Custom Plugin Page
- Best practice: What belongs in theme and what in plugin for large eCommerce website
- Link to a admin submenu item using a custom link
- Adding class to the parent of current-post-ancestor / current-menu-parent / current-post-parent
- Change the search results header from plugin
- Dynamic banner for use on external sites
- Adding Meta box to thrid-party plugin
- How do I store a custom dataset in WordPress to best take advantage of API?
- Developing Themes on WordPress, Looking for Excellent Tutorials [closed]
- How to Implement SAM Broadcaster with WordPress? [closed]
- Is Explicit Versioning a better alternative to Semantic Versioning for wordpress?
- Custom plugin not appearing
- Extend WP_List_Table class – Edit wp_usermeta – WPPB.me Boilerplate – Action error
- Is there any other ways to replicating changes on live from staging without pushing from git
- Can I log the searches that are returning 404 in the DB?
- Custom fields in the billing address section woocommerce
- Add File field in WooCommerce Box office plugin
- Remove and strip html tag values