Title: wp_should_replace_insecure_home_url
Published: March 9, 2021
Last modified: May 20, 2026

---

# apply_filters( ‘wp_should_replace_insecure_home_url’, bool $should_replace_insecure_home_url )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/wp_should_replace_insecure_home_url/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/wp_should_replace_insecure_home_url/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/wp_should_replace_insecure_home_url/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/wp_should_replace_insecure_home_url/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/wp_should_replace_insecure_home_url/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/wp_should_replace_insecure_home_url/?output_format=md#wp--skip-link--target)

Filters whether WordPress should replace old HTTP URLs to the site with their HTTPS
counterpart.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/wp_should_replace_insecure_home_url/?output_format=md#description)󠁿

If a WordPress site had its URL changed from HTTP to HTTPS, by default this will
return `true`. This filter can be used to disable that behavior, e.g. after having
replaced URLs manually in the database.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/wp_should_replace_insecure_home_url/?output_format=md#parameters)󠁿

 `$should_replace_insecure_home_url`bool

Whether insecure HTTP URLs to the site should be replaced.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/wp_should_replace_insecure_home_url/?output_format=md#source)󠁿

    ```php
    return apply_filters( 'wp_should_replace_insecure_home_url', $should_replace_insecure_home_url );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/https-migration.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/https-migration.php#L37)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/https-migration.php#L37-L37)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/wp_should_replace_insecure_home_url/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_should_replace_insecure_home_url()](https://developer.wordpress.org/reference/functions/wp_should_replace_insecure_home_url/)`wp-includes/https-migration.php` |

Checks whether WordPress should replace old HTTP URLs to the site with their HTTPS counterpart.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/wp_should_replace_insecure_home_url/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_should_replace_insecure_home_url%2F)
before being able to contribute a note or feedback.