Title: _reset_front_page_settings_for_post
Published: April 25, 2014
Last modified: August 20, 2026

---

# _reset_front_page_settings_for_post( int $post_id )

## In this article

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

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Resets the page_on_front, show_on_front, and page_for_post settings when a linked
page is deleted or trashed.

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

Also ensures the post is no longer sticky.

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

 `$post_id`intrequired

Post ID.

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

    ```php
    function _reset_front_page_settings_for_post( $post_id ) {
    	$post = get_post( $post_id );

    	if ( 'page' === $post->post_type ) {
    		/*
    		 * If the page is defined in option page_on_front or post_for_posts,
    		 * adjust the corresponding options.
    		 */
    		if ( (int) get_option( 'page_on_front' ) === $post->ID ) {
    			update_option( 'show_on_front', 'posts' );
    			update_option( 'page_on_front', 0 );
    		}
    		if ( (int) get_option( 'page_for_posts' ) === $post->ID ) {
    			update_option( 'page_for_posts', 0 );
    		}
    	}

    	unstick_post( $post->ID );
    }
    ```

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

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

| Uses | Description | 
| [unstick_post()](https://developer.wordpress.org/reference/functions/unstick_post/)`wp-includes/post.php` |

Un-sticks a post.

  | 
| [update_option()](https://developer.wordpress.org/reference/functions/update_option/)`wp-includes/option.php` |

Updates the value of an option that was already added.

  | 
| [get_option()](https://developer.wordpress.org/reference/functions/get_option/)`wp-includes/option.php` |

Retrieves an option value based on an option name.

  | 
| [get_post()](https://developer.wordpress.org/reference/functions/get_post/)`wp-includes/post.php` |

Retrieves post data given a post ID or post object.

  |

[Show 2 more](https://developer.wordpress.org/reference/functions/_reset_front_page_settings_for_post/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/_reset_front_page_settings_for_post/?output_format=md#)

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

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

## User Contributed Notes

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