You can’t, it’s as simple as that.
Why Not?
First of all, because the DIV is not part of your content. It’s either generated by WordPress’ filters, or the browser itself. So, you can’t do preg_replace on something that doesn’t exist.
Secondly, there’s a matter of cross-domain policy. It’s not possible to manipulate the content of an iframe unless the two webpages belong to the same domain. Anything else, and you will get a security error. This is intentional, and to prevent acts such as spoofing.
For further information, take a look at this link.
Related Posts:
- str_replace function in theme
- Shortcode to eliminate and replace with
- opening links in new tab using – add_filter( ‘the_content’, ‘make_clickable’);
- Default or Preset Content for Custom Post Types
- How would go about if I just want a temporary function?
- Adding HTML to the end of every post with the Block Editor
- Insert image in WordPress with HTML5 tag and caption function
- Add Element as a Filter to the_content
- login_headertitle is deprecated since version 5.2.0
- Insert Content Before div#main from the functions.php File
- Problem with images URL after filter applying
- Save_post – Warning: Cannot modify header information
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- $content is empty while using DOMDocument
- How to make an If Else on Excerpt Filter
- child_of not working while searching
- remove empty paragraphs from the_content?
- Add multiple custom fields to the general settings page
- Set JPEG compression for specific custom image sizes
- Define custom Page Template without its own .php file
- Woocommerce add to simple product attribute programmatically [closed]
- Issue with get_theme_mod returning a blank value instead of the saved value
- How to remove row-actions from pages table?
- Insert Ad Code in the Middle of a Post
- Auto delete WordPress images/thumbnails (all sizes) and featured after X days/hours, or similar?
- How to fix a theme with page.php Default Template that accidentally deleted?
- Override parent theme function that is not hooked or in the functions.php file
- Programmatically Add Font-Awesome Icons to Category Widget
- Change comments form title on a page by page basis
- Remove bulk actions based on user role or capabilities
- How do I change parameters without changing the core
- Problem with extract() with custom shortcode
- Removing title from page
- get_the_excerpt() not returning anything when post has no excerpt
- add sidebar area to header of child theme
- Adding body class when post contains a specific shortcode
- How to make unique add_filter to the_content of specific page template files – so each template gets its own addition
- Creating loop within functions.php
- Limit filter upgrader_post_install to a single plugin
- How to update feed only 2-3 times a week (for Feedburner email)?
- Manipulate Output of wp_list_something: select menu instead of li’s
- Wrap First Character after in a tag
- Pass Shortcode Attribute to footer Script
- PHP files included in functions.php don’t seem to work
- How Can I Expand the WordPress Customize window without any Plugin?
- Can’t check if a post has thumbnail adding filter to get_post_metadata()
- Automatically wrap multiple images in div
- Ajax not working properly
- How can I remove the main description text box in a Woocommerce product editor page? I only use the “Product short description” text box [closed]
- Filtering out the #more anchor link that gets produced by
- append to existing parent theme function
- How can I add a filter for specific categories on functions.php?
- How would I go about replacing this function in my child theme located in inc/template-tags.php
- Condition OR for current user ID
- Retrieve a value from Yoast SEO to use to set a default twitter card image honoring overrides
- Insert template-part inside the content
- Where do I store custom functions that call custom page template files?
- Redefine function arguments before rendering
- Wp-query Order By problem
- How can I add a class to a nav li depending on URL?
- does wp function the_content(); accept another tag inside
- Different favicon on different pages
- first paragraph of the_content as meta description
- Changing where my author box is printed
- Add Adsense code between job listings – wp job manager plugin
- Replace header image on all other pages but home – URL issue
- Insert a field with PREG_REPLACE – strange behaviour
- How to echo Widget Title in Custom Frontend-Template Box
- how to display a page before the home page
- loginout function customization
- implementing a centralized content “show-do-not-show” toggle?
- How would I make a function to dynamically determine if user is logged to change navigation menu text?
- How to display this meta data (an array) in form of a function (created with a custom write panel)?
- WordPress – using sessions?
- how can I add filter in specfic field in my website?
- Customizing the wp_video_shortcode output with add_filter
- How to add HTML into error message
- How to bind each “the_content” elements to a custom variables
- Extend WordPress Audio Widget to accept HLS (.m3u8) URLs
- How Can I Concatenate A String With One Of My Custom Field Value Before Saving The Post?
- function replace_text for entire page
- add product thumbnail to checkout page only and include variation name
- WordPress Ajaxifying not working properly
- WordPress function with attribute pass to template
- Will dequeueing in child theme functions.php file prevent Google Fonts from loading?
- Graphic before title – Specific Category
- Which method is more correct for removing WooCommerce Extensions menu item?
- Help! Need a different logo on my main page from my other pages
- Display page number on custom page title function
- How to replace words in my posts and saved new words
- Why might wptexturize have become re-enabled?
- functions.php filters not applied in AJAX call
- Settings in functions.php used by a plugin
- Can’t change excerpt length and more tag
- Why does modifying my functions.php file always result in a server error
- Remove snippets of JS from core
- Explode Array from Repeatable Custom Field
- Warning: call_user_func_array() expects parameter 1 to be a valid callback
- Advanced Custom Fields in WP_Query: Clickable Text in List Format
- Add custom css to specific user