获取设置为帖子页面的页面的页面ID


53

在WordPress设置中,您可以将页面设置为Posts Page。可以找到:

WP-Admin->Settings->Reading Settings->Front page displays

首页显示设置

如何检索在此设置中设置的页面ID?

Answers:


78

使用page_for_posts选项:

<?php
$page_for_posts = get_option( 'page_for_posts' );
?>

这将返回为显示博客文章索引而分配的页面的ID。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.