array( 'type' => 'array', 'items' => array( 'type' => 'integer' ), 'maxItems' => 200, 'description' => __( 'Audit exactly these posts, returned in the order given. Naming ids overrides post_types and post_statuses unless you also pass them, so a draft or a custom post type is reported rather than silently missing, and the whole set comes back in one response regardless of per_page. It also flips only_issues to false by default, so healthy posts still appear — pass only_issues explicitly to override that.', 'acrossai-abilities-manager' ), ), 'post_types' => array( 'type' => 'array', 'items' => array( 'type' => 'string' ), 'description' => __( 'Post types to audit. Defaults to post and page, or to every type when post_ids is given.', 'acrossai-abilities-manager' ), ), 'post_statuses' => array( 'type' => 'array', 'items' => array( 'type' => 'string' ), 'description' => __( 'Statuses to audit. Defaults to publish, or to every status when post_ids is given.', 'acrossai-abilities-manager' ), ), 'per_page' => array( 'type' => 'integer', 'default' => 50, 'minimum' => 1, 'maximum' => 200 ), 'page' => array( 'type' => 'integer', 'default' => 1, 'minimum' => 1 ), 'search' => array( 'type' => 'string' ), 'score_below' => array( 'type' => 'integer', 'default' => 70, 'minimum' => 0, 'maximum' => 100, 'description' => __( 'Flag posts whose stored score is below this. Never-scored posts are not flagged as low-scoring.', 'acrossai-abilities-manager' ), ), 'include_schema' => array( 'type' => 'boolean', 'default' => true ), 'include_inbound' => array( 'type' => 'boolean', 'default' => false, 'description' => __( 'Also check inbound internal links. Off by default because it scans site content and is slower.', 'acrossai-abilities-manager' ), ), 'only_issues' => array( 'type' => 'boolean', 'description' => __( 'Return only posts with problems. Set false to list everything with its metadata. Defaults to true when sweeping, and to false when post_ids names an exact set.', 'acrossai-abilities-manager' ), ), ); } protected function output_properties(): array { return array( 'items' => array( 'type' => 'array' ), 'total' => array( 'type' => 'integer' ), 'page' => array( 'type' => 'integer' ), 'pages' => array( 'type' => 'integer' ), 'counts' => array( 'type' => 'object' ), ); } protected function required_input(): array { return array(); } protected function annotations(): array { return array( 'readonly' => true, 'destructive' => false, 'idempotent' => true ); } /** * @param array $input * @return array|WP_Error */ protected function run( array $input ) { $result = Content_Audit_Repository::audit( $input ); $flagged = array_sum( $result['counts'] ); $result['message'] = 0 === $flagged ? sprintf( /* translators: %d: number of posts examined */ __( 'Examined %d posts and found no Rank Math SEO gaps.', 'acrossai-abilities-manager' ), $result['total'] ) : sprintf( /* translators: 1: number of posts returned, 2: total issues found */ __( 'Returned %1$d posts with %2$d Rank Math SEO issues between them.', 'acrossai-abilities-manager' ), count( $result['items'] ), $flagged ); return $result; } }