is_noindex( $post ) ) { $score -= 30; $issues[] = __( 'This post is marked noindex by an SEO plugin — AI crawlers may skip it.', 'aeomatic' ); $recommendations[] = __( 'Remove the noindex directive if this content is meant to be discoverable.', 'aeomatic' ); } if ( get_permalink( $post ) === false ) { $score -= 15; $issues[] = __( 'No canonical / permalink derivable — permalink structure may be broken.', 'aeomatic' ); $recommendations[] = __( 'Re-save permalink settings and confirm this post opens at a stable URL.', 'aeomatic' ); } if ( ! $this->included_in_llms_txt( $post ) ) { $score -= 20; $issues[] = __( 'This post is not included in the site\'s llms.txt index.', 'aeomatic' ); $recommendations[] = __( 'Open AEOmatic → Settings → llms.txt and enable this post type for inclusion.', 'aeomatic' ); } $text = trim( (string) wp_strip_all_tags( (string) $post->post_content ) ); if ( str_word_count( $text ) < 20 ) { $score -= 20; $issues[] = __( 'Server-rendered body is under 20 words — content may be JS-only or hidden behind a page builder that AI crawlers cannot parse.', 'aeomatic' ); $recommendations[] = __( 'Ensure the page body renders text in the initial HTML response, not just via JavaScript.', 'aeomatic' ); } if ( ! $this->ai_headers_enabled() ) { $score -= 15; $issues[] = __( 'AI HTTP discovery headers (X-AI-Crawl, X-AI-Citeable, etc.) are disabled.', 'aeomatic' ); $recommendations[] = __( 'Enable AI HTTP headers in AEOmatic → Settings for automatic AI-crawler discovery signals.', 'aeomatic' ); } return new AEOMATIC_Readiness_Result( 'technical', $score, $issues, $recommendations ); } private function is_noindex( WP_Post $post ): bool { $keys = array( '_yoast_wpseo_meta-robots-noindex' => static fn( $v ) => (string) $v === '1', 'rank_math_robots' => static fn( $v ) => is_array( $v ) ? in_array( 'noindex', $v, true ) : false, '_aioseo_robots_noindex' => static fn( $v ) => (string) $v === '1' || $v === true, '_seopress_robots_index' => static fn( $v ) => (string) $v === 'yes', ); foreach ( $keys as $meta_key => $check ) { $val = get_post_meta( $post->ID, $meta_key, true ); if ( $val !== '' && $val !== null && $check( $val ) ) { return true; } } return false; } private function included_in_llms_txt( WP_Post $post ): bool { if ( ! class_exists( 'AEOMATIC_LLMs_Txt' ) ) { return true; // Nothing to check against; don't penalise. } if ( method_exists( 'AEOMATIC_LLMs_Txt', 'is_post_included' ) ) { return (bool) AEOMATIC_LLMs_Txt::is_post_included( $post ); } if ( class_exists( 'AEOMATIC_Post_Types' ) ) { $enabled = AEOMATIC_Post_Types::get_enabled_slugs(); return in_array( $post->post_type, (array) $enabled, true ); } return true; } private function ai_headers_enabled(): bool { if ( ! class_exists( 'AEOMATIC_Settings' ) ) { return false; } $enabled = AEOMATIC_Settings::get( 'ai_headers', 'enabled' ); if ( $enabled === null || $enabled === '' ) { return true; // Default-on in the plugin. } return (bool) $enabled; } }