@@ -89,7 +89,9 @@ function register_activation_hook(string $file, callable $callback): void {}
8989function register_deactivation_hook(string $file, callable $callback): void {}
9090
9191function is_admin(): bool {}
92+ /** @param string|array<string> $post_types */
9293function is_singular(string|array $post_types = ''): bool {}
94+ /** @param int|string|array<int|string> $page */
9395function is_page(int|string|array $page = ''): bool {}
9496function is_multisite(): bool {}
9597function current_user_can(string $capability, mixed ...$args): bool {}
@@ -126,7 +128,7 @@ function wp_add_inline_script(string $handle, string $data, string $position = '
126128 * @param string $menu_slug
127129 * @param callable $callback
128130 */
129- function add_options_page(string $page_title, string $menu_title, string $capability, string $menu_slug, callable $callback = null): string|false {}
131+ function add_options_page(string $page_title, string $menu_title, string $capability, string $menu_slug, ? callable $callback = null): string|false {}
130132
131133/**
132134 * @param string $option_group
@@ -176,6 +178,7 @@ function get_admin_page_title(): string {}
176178function admin_url(string $path = '', string $scheme = 'admin'): string {}
177179function esc_html(string $text): string {}
178180function esc_attr(string $text): string {}
181+ /** @param array<string>|null $protocols */
179182function esc_url(string $url, ?array $protocols = null, string $_context = 'display'): string {}
180183function __(string $text, string $domain = 'default'): string {}
181184function esc_html__(string $text, string $domain = 'default'): string {}
@@ -192,3 +195,112 @@ function selected(mixed $selected, mixed $current = true, bool $echo = true): st
192195function get_sites(array $args = []): array {}
193196function switch_to_blog(int $new_blog_id): bool {}
194197function restore_current_blog(): bool {}
198+
199+ // Block functions
200+ /** @param array<string, mixed> $args */
201+ function register_block_type(string $block_type, array $args = []): mixed {}
202+ /** @param array<string, mixed> $extra_attributes */
203+ function get_block_wrapper_attributes(array $extra_attributes = []): string {}
204+
205+ // REST API functions
206+ /**
207+ * @param string $namespace
208+ * @param string $route
209+ * @param array<string, mixed> $args
210+ */
211+ function register_rest_route(string $namespace, string $route, array $args = []): bool {}
212+ function sanitize_textarea_field(string $str): string {}
213+
214+ // Post functions
215+ function get_post(int $post_id): ?WP_Post {}
216+ function get_post_type(?int $post_id = null): string|false {}
217+ function get_post_meta(int $post_id, string $key = '', bool $single = false): mixed {}
218+ function update_post_meta(int $post_id, string $key, mixed $value): int|bool {}
219+ function delete_post_meta(int $post_id, string $key, mixed $value = ''): bool {}
220+ /** @param array<string, mixed> $postarr */
221+ function wp_update_post(array $postarr, bool $wp_error = false, bool $fire_after_hooks = true): int|\WP_Error {}
222+ function is_wp_error(mixed $thing): bool {}
223+ function is_feed(): bool {}
224+
225+ // Comment functions
226+ function get_comment(int $comment_id): ?WP_Comment {}
227+ function get_comment_meta(int $comment_id, string $key = '', bool $single = false): mixed {}
228+ function update_comment_meta(int $comment_id, string $key, mixed $value): int|bool {}
229+ function delete_comment_meta(int $comment_id, string $key, mixed $value = ''): bool {}
230+ /** @param array<string, mixed> $commentarr */
231+ function wp_update_comment(array $commentarr, bool $wp_error = false): int|\WP_Error {}
232+ /**
233+ * @param array<string, mixed> $args
234+ * @return array<WP_Comment>
235+ */
236+ function get_comments(array $args = []): array {}
237+
238+ // Kses
239+ function wp_kses_post(string $data): string {}
240+
241+ /**
242+ * WordPress Post class stub.
243+ */
244+ class WP_Post {
245+ public int $ID;
246+ public string $post_content;
247+ public string $post_type;
248+ public string $post_status;
249+ public string $post_title;
250+ }
251+
252+ /**
253+ * WordPress Comment class stub.
254+ */
255+ class WP_Comment {
256+ public int $comment_ID;
257+ public string $comment_content;
258+ public string $comment_approved;
259+ public int $comment_post_ID;
260+ }
261+
262+ /**
263+ * WordPress Query class stub.
264+ */
265+ class WP_Query {
266+ /** @var array<WP_Post> */
267+ public array $posts = [];
268+ /** @param array<string, mixed> $args */
269+ public function __construct(array $args = []) {}
270+ }
271+
272+ /**
273+ * WordPress Error class stub.
274+ */
275+ class WP_Error {
276+ public function __construct(string $code = '', string $message = '', mixed $data = '') {}
277+ public function get_error_message(): string {}
278+ public function get_error_code(): string {}
279+ }
280+
281+ /**
282+ * WP-CLI class stub.
283+ */
284+ class WP_CLI {
285+ public static function log(string $message): void {}
286+ public static function success(string $message): void {}
287+ public static function warning(string $message): void {}
288+ public static function error(string $message, bool $exit = true): void {}
289+ /** @param array<string, mixed> $assoc_args */
290+ public static function confirm(string $question, array $assoc_args = []): void {}
291+ /** @param array<string, mixed> $args */
292+ public static function add_command(string $name, string|object $callable, array $args = []): bool {}
293+ }
294+
295+ /**
296+ * HTMLPurifier stubs.
297+ */
298+ class HTMLPurifier {
299+ public function __construct(?HTMLPurifier_Config $config = null) {}
300+ public function purify(string $html): string {}
301+ }
302+
303+ class HTMLPurifier_Config {
304+ public static function createDefault(): self {}
305+ public function set(string $key, mixed $value): void {}
306+ }
0 commit comments