Yes, it is possible.
You can use the_content
hook and assign your own filter to this hook.
Then you should (that is the part when things get a little bit messy) parse and replace content of that post.
So for example you can do it like so:
function my_the_content_filter($content) {
$content = str_replace('<h2 ', '<img src=""...><h2 ', $content);
return $content;
}
add_filter( 'the_content', 'my_the_content_filter' );
Related Posts:
- Where to hook into post content?
- How to change the order (priority) of registered filters (or actions) (e.g. for the_content)?
- Post Content, Special Characters and Filters
- Add content as soon starts
- Scanning for custom embed and prefetching
- Add class to all parent elements inside the_content
- WordPress hooks/filters insert before content or after title
- apply_filters(‘the_content’, $content) vs do_shortcode($content)
- How do filters and hooks really work in PHP
- Trouble understanding apply_filters()
- the_content and is_main_query
- How to appending to the_content using add_filter with custom post type?
- How many filter/action hooks are healthy?
- How to wrap an element around an iframe or embed in content automatically?
- Filter specific shortcode output?
- WordPress Internal @ Mentions
- Earliest hook to reliably get $post/$posts
- How to pass/get data to/from the WooCommerce data-product_variations object?
- What does (10, 2) mean when used with add_filter
- Clarification on filters and hooks
- Valid characters for actions, hooks and filters
- Insert Custom HTML After Shortcode
- How to hook into unregistering a widget instance?
- How to check if a hook is hooked or not?
- Passing Additional Parameters to add_filter Callable
- What hook do I use to edit the post statuses option in admin?
- Add whitespace between Chinese and other letters
- Filter hook before create order WooCommerce
- Modify WordPress Rest Api Request/Response
- How to add some custom HTML into wordpress admin bar?
- Hook added to the_content seems to be called multiple times
- Get excerpt from $post->post_content
- Custom theme hooks / filters – passing arguments
- wp_mail – Remove sitename from email subject
- Add Class to Specific Paragraph of the_content()
- add_filter for specific pages
- What params are available with the_content filter?
- How to disable all WordPress emails modularly and programatically?
- How to hook wp_list_pages?
- apply_filters() slices away needed arguments
- WP Rest API – Upload media without saving attachment post
- Using variable from one filter in another filter
- apply_filters(‘the_content’, $content) alternative
- What effect does the_content filter have on performance?
- How to make post and comment count unclickable with dashboard_glance_items hook
- How to use the_excerpt in a filter hook?
- How to add attribute to output with wp_video_shortcode add_filter
- How to change Woocommerce breadcrumbs content?
- Hook into admin post list page
- Anyway to edit the titlebar of WordPress Widgets in the Admin area?
- How to limit the pages displayed for choosing parent page on page attribute’s menu?
- How can I hide all posts that don’t have a thumbnail?
- How can I display image metadata?
- Change text of Description in Image Library
- Load different template file when condition met?
- Add post/page ID to inserted links within the_content
- Am I using the right hook for removing quicktags on the admin TinyMCE?
- How to apply content filter permanently?
- How to prepend text to the_content, but after img/shortcode
- About Hooks and Filters
- How to enable visual editor when editing comments on the dashboard?
- Should I use add_action(‘publish_post or add_filter(‘publish_post?
- Please explain me what the do_action does
- Format content value from DB outside of WordPress filters
- Is it possible to Hook/Filters Attachment Creation?
- Filter all html output
- Can’t get wp_title filter working in twenty sixteen child theme
- How can I reliably and globally disable wptexturize?
- Customise Jetpack Publicize text
- Removing labels and tag on WordPress’s default login form
- WordPress RSS feed – filter RSS content by custom field value
- What is the filter hook for custom fields content?
- How to trigger the core WPLANG to make automatically set a language when the theme is activated? [duplicate]
- How to hook some Unicode texts into calendar widget safely?
- How to add attributes to tag when template cannot be directly modified
- filter the_title problem in nav
- How can I add a fifth option to the alignment picker?
- Too many actions/filters!
- Filter the URL of next_posts_link & previous_posts_link
- why does the add_action(‘the_content’) overwrite my page
- How to get list of all hooks of current theme / plugin?
- Which hook is fired when inserting media into a post
- How to replace any occurence of Gravatars with a local placeholder image?
- How does WordPress call functions attached to a certain action hook before calling functions attached to other hooks
- What functions are included in apply_filter(‘the_content’)
- Sensei LMS Hooks to Remove Content
- Filter Gutenberg Blocks Content
- What hook/filter can I use to add/edit/show/hide the title under (on hover) links on the table view?
- Customize user account activation message
- Conditionally call add_action depending on post_type?
- Return array of images after content
- Nested calls the the_content filter
- Change WordPress RSS link with filter?
- WordPress tag cloud add more links
- Add a header before fields added with the attachment_fields_to_edit() filter
- Error when overriding only some audio shortcode HTML output
- Hide content editor for posts after approriate date
- Why anything done on comments_array hook gets reset?
- Gutenberg disable the “block” tab in right sidebar
- Why my admin doesn’t work after adding rest_prepare_post filter?