block_core_calendar_update_has_published_posts

函数
block_core_calendar_update_has_published_posts ( No parameters )

block_core_calendar_update_has_published_posts: 这个函数用来更新WordPress日历中所有日期的has_published_posts元值。它不接受任何参数。

查询数据库中任何已发表的文章,并保存一个标志,以确定是否存在任何已发表的文章。

function block_core_calendar_update_has_published_posts() {
	global $wpdb;
	$has_published_posts = (bool) $wpdb->get_var( "SELECT 1 as test FROM {$wpdb->posts} WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1" );
	update_option( 'wp_calendar_block_has_published_posts', $has_published_posts );
	return $has_published_posts;
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-05 16:32:56

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: