Figured it out! The function I needed to hook is called “the_content”, because that’s the post content that is pulled directly from the database.
I added this code into the functions.php file for my theme.
function force_https_the_content($content) {
if ( is_ssl() )
{
$content = str_replace( 'src="http://', 'src="https://', $content );
}
return $content;
}
add_filter('the_content', 'force_https_the_content');
Related Posts:
- WP media attachment location vs permalink
- SSL Error: unable to get local issuer certificate
- https connection using CURL from command line
- Curl command for https ( SSL )
- nodejs – error self signed certificate in certificate chain
- Simple Java HTTPS server
- HTTPS connection Python
- Java: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
- How do you redirect HTTPS to HTTP?
- Could not establish secure channel for SSL/TLS with authority ‘*’
- Python requests SSL error – certificate verify failed
- How can I force users to access my page over HTTPS instead of HTTP?
- How to force Laravel Project to use HTTPS for all routes?
- How can I fix the “No certificates found – The app Chrome has requested a certificate” Android / Google Chrome issue
- Issues with installing python libraries on Windows : CondaHTTPError: HTTP 000 CONNECTION FAILED for url
- How To Retrieve An Image Attachment’s Alt Text?
- How to manage attachment relationships for specific posts in WP 3.5+
- SSL Breaks WordPress CSS
- Setting $_SERVER[‘HTTPS’]=’on’ prevents access to wp-admin
- Can I add a Category Metabox to attachment?
- Change attachment filename
- How to get attachment file name not attachment URL
- Disable SSL / HTTPS for wordpress
- How to trigger a refresh in the media modal
- Switching MultiSite installation from HTTP to HTTPS
- Why is WordPress redirecting from http to https on a local environment?
- Get all post attachments except featured image
- Programmatically adding images to the media library with wp_generate_attachment_metadata randomly fails
- getting attachement images src and add classes
- How can I bulk delete media and attachments using WP-CLI?
- Is there a way to force ssl on certain pages
- Getting a taxonomy’s thumbnail url
- Check if post has attachments (not image)
- How to cleanly delete attachment but retain original file?
- Changing attachment urls?
- Add custom class to attachment in media library grid mode
- Are captions stored anywhere?
- SSL breaks customizer: page isn’t returned from ajax
- Trying to hide buttons from Attachment window
- get_the_post_thumbnail() doesn’t taking style attribute
- Disable all https in WordPress
- Expanding new Media Uploader in WordPress 3.5
- How can I UN-attach media from a post?
- Uploading Multiple Attachments From Front-End With A Description
- Validate alt text for attachments?
- How to use WordPress multisite with mixed HTTP and HTTPS sites?
- complex restriction of items in media library
- Remove duplicate attachments
- Edit image / Delete image link
- How could I add button next to “edit image” button in “Attachment Details”
- Applying automatic link class to images embedded to posts
- How to get attachment caption (get_the_excerpt gives parent post excerpt) ?
- Local version of a WordPress site – SSL/HTTPS enforced?
- Force HTTPS using .htaccess – stuck in redirect loop
- Is it possible to query specific WordPress Attachment files (.ppt & .pdf) and output them in a list?
- media_sideload_image file name?
- Get all posts (of any post type) an attachment is used in
- bloginfo() and get_template_directory_uri() with SSL?
- After updating site to use SSL all images in posts point to http://
- Detect if is image unattached
- How to single click to download image in single post
- WordPress is Inserting images into Post as HTTP and not HTTPS
- delete attachment from front end
- Unattaching unlinked images
- How to get attachments for a specific post type?
- Give attachments an archive page
- custom fields for attachments?
- Insert Media – Attachment – Link to : Remove the “attachment page” option
- Show Post ID in “Find Posts or Pages” box in Media Library?
- URL rewrite with add_rewrite_rule and attachment_id
- How to add media from front-end to an existing post?
- Adding https to wordpress website
- Upgrade to SSL Breaks Admin Dashboard
- How to set author for post AND post attachments
- Can I attach a document (eg: PDF) but have a JPEG as a thumbnail?
- Retrieving a custom link on an attachment
- Get attachment from post
- How can I display custom fields value from attachment media?
- How to redirect url requests to https? [closed]
- Delete attachments from Front end
- Globally force SSL on all pages
- Is the WordPress HTTPS Plugin Still Safe To Use? [closed]
- Add column for attachment file size
- Force home page to be https?
- Creating a multi-file upload form on the front end for attachments
- how to test for attached image
- Admin-Ajax.php, SSL, Non-SSL
- Unable to upload specific .zip file type via frontend in WordPress 4.0
- Get attachments (get_posts) and WP 3.5 new uploader
- get post attachments of a particular size
- Change image link: wp_get_attachment_link
- Multi-line captions on attachments
- Make individual attachments private?
- How disable SSL redirect for specific URL?
- exposing attachment uploading to the front end — delicate
- Gel all image from certain post type
- Making images from single.php pointing to an attachment .php template
- Add_Filter example for wp_get_attachment_link
- Serve HTTPS requests from subdomain
- WordPress Move to SSL How to Update Media Assets to HTTPS?