
如何解决MAMP本地开发环境“Localhost Refused to Connect”错误
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; }