The problem is not that the function you’re using adds http:
, the problem is it adds no URL schema at all!
As a result, WP needs to add a URL schema to turn the host into a URL, and so it uses http://
. It has no way of knowing what the original was, or if the host supports HTTPS, so http://
is the safe bet.
If however you passed the array with URL schema added, it would be passed through without issue.
Something like this may do the trick:
$hosts = wp_dependencies_unique_hosts();
$urls = array_map( function( $host ) {
return set_url_scheme( $host, 'https' );
}, $hosts );
In the longrun though, it would be better to get the actual URLs and distill the host URL out of them, rather than relying on wp_dependencies_unique_hosts
if you wanted to preserve the mixture of http
and https
Related Posts:
- Remove meta description on certain pages
- How to style injected code in header section?
- How to remove get_header From all single pages in wordpress with functions.php without plugin?
- Load admin bar without wp_head or wp_footer [duplicate]
- Particular meta tag – viewport – insertion when dealing with plugin
- How to Add Image to WordPress RSS-Feed with no Plug-in?
- WordPress Infinite Scroll without using any plugin
- How to remove a metabox from menu editor page?
- How to add active class to custom menu using while loop and wp_list_pages
- show limited tags in an article
- Using a function written in my functions.php file within the header.php file
- Disable External Pingacks on WordPress Posts and Only Allow ‘Self Pings’
- Is the regular ajax request method safe or I should use admin-ajax.php?
- Create an array from an array
- Using wp_get_image_editor in a standalone script
- Woocommerce: Is it possible to overide the settings for allowing to purchase out of stock products [closed]
- Can I change a variable in a content part while calling it?
- WordPress Redirect: Default Password Reset URL [duplicate]
- PHP Deprecated: WP_RSSjb has a deprecated constructor
- action hook wp_head higher priority as all other plugins/hooks
- Shortcode return function with link href inside PHP
- Set WordPress Default Template
- Can’t get page content in WordPress
- Function not working at one place
- Get date numerical and separate?
- How to check if a meta value has already been assigned to any user?
- How to prevent WP_Query function from returning all posts when empty?
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- How to call plugin function per site in a multisite?
- foreach loop still echoes array
- dynamic dependent select dropdown
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- wp_head function not outputting
- wp-comments-post.php file returns a blank page
- Add .htm extention to a custom taxonomy
- Custom gallery in wp3.5
- Noscript not working as it should in wordpress site
- How to use theme function in post/page?
- esc_url( ) won’t use https
- Pagination broken on is_front_page()
- Content filter won’t work
- Why does the post_type_link hook everything twice?
- Warning: in_array() null given in PHP function
- Use post ID in functions.php file adminside
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- use loop to return blog details
- How can I count ACF sub_field with a certain value
- Fetching Initials of the Commentator in the WordPress Website
- Adding function to child theme’s function.php
- Missing a text-domain esc_attr_e
- Custom posts password protect
- How to get post category list as select in front-end?
- Extract and display user infromation on an automatically created page
- Is it legal to redefine wp_password_change_notification in a mu plugin?
- How can I assign separate stylesheets to different pages?
- Programmatically revert to backup .htaccess a possibility?
- Execute PHP code only with specific user role
- WP Container Displaying Only on First Page of Archive
- Woocommerce – Exclude variation attribute on specific variation
- How do I add a function to parent theme
- PHP function for horizontal Woocommerce thumbnails and badges
- Add Pre-Defined Value to Click Counter in WordPress
- Embed video from streamtape using direct link
- Is there a PHP function that will return the block ID generated by WordPress?
- Creating a Function and Call It
- WooCommerce display price before add to cart [closed]
- Show sidebar only to author of post
- How to move a post from one category to another
- Show data obtained from a function and place it in a shortocode function
- how to add custom select field to wordpress edit page
- How to override theme’s public static function inside of a trait?
- Delete empty title_tags, find a h1 heading and echo it
- how to use 2 index.php file One for mobile and one for desktop
- WP_Query To Display Product Of Brand On Taxonomy Page
- Theme editing “post thumbnail” help
- How can I export data without using any import/export plugin
- Search for images that width and height is more than 500
- Matching multi user
- Add disclaimer before certain posts and pages
- Where can I find the declaration of `$_wp_theme_features`?
- redirect 301 with special character like WIX site “#!”
- auto metakey value on post tile
- How do I routinely extract the thumbnail of the most recent post?
- wordpress ajax return 0
- How I can add div to menu?
- Modify category archive page loop on functions.php
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- How to print redirected query string variables to the page?
- Admin-area broken through weird issues
- Check if values exists DB
- Overwriting a Shortcode
- Search box background on a different page template
- WP Ecommerce: Display the “Order Notes” as column in the Sales Log [closed]
- How to modify this function to exclude also the post belonging to a specific category?
- A next page function with shortcode?
- What is the wrong with this function to enqueue the scripts and styles to the theme? [closed]
- Alternative to php echo within code
- Add multiple HTML attributes to an Elementor button
- Automatically change insurance quantity based on cart total [closed]
- hiddenQuestions.find is not a function