resolver = $resolver; $this->field_map = $field_map; $this->post_access_checker = $post_access_checker; } /** * Retrieves the SEO data for the posts matching the input. * * @param array $input The input containing an optional 'post_id', 'permalink', or 'title'. * * @return array>|WP_Error The SEO data for each matching post, or an error. */ public function get_post_seo_data( array $input ) { $indexables = $this->resolver->resolve_many( $input ); if ( $indexables instanceof WP_Error ) { return $indexables; } $editable = $this->post_access_checker->filter_editable( $indexables ); // Every match was a post the user may not edit; an already empty match list // (a title-search page past the last result) stays a valid empty result. if ( $editable === [] && $indexables !== [] ) { return $this->post_access_checker->forbidden_error(); } return $this->field_map->indexables_to_arrays( $editable ); } }