'page', 'post_status' => 'publish', 'post_title' => __( 'Advent calendar', 'advently' ), 'post_content' => '', ], true ); return is_wp_error( $id ) ? 0 : (int) $id; } /** * The newest published page that already holds the shortcode or the block. */ private static function find(): int { global $wpdb; // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- rare lookup (admin, emails), no API searches post content. return (int) $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_type = 'page' AND post_status = 'publish' AND ( post_content LIKE %s OR post_content LIKE %s ) ORDER BY post_date DESC LIMIT 1", '%' . $wpdb->esc_like( '[advently' ) . '%', '%' . $wpdb->esc_like( '