функция
since 3.7.0
_reset_front_page_settings_for_post()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
_reset_front_page_settings_for_post( int $post_id )
Описание
Также гарантирует, что запись больше не является прилепленной.
Оригинал (английский)
Also ensures the post is no longer sticky.
Параметры
$post_id
int
обязательный
Идентификатор записи.
Исходный код
wp-includes/post.php:3973
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 );
}
История изменений
| Версия | Описание |
|---|---|
| 3.7.0 | Introduced. |

