' (a plugin settings section, anchor matches that * section's DOM id on the Settings screen), 'theme' (outside the post's own * content — a competing plugin/theme interfering with this plugin's own * output), or 'hosting' (the server itself, e.g. a page that didn't * respond). The Audit screen renders "Edit"/"Go to settings"/explanation-only * accordingly (1.3). * * An unknown issue_key (an older `details_json` row from before this catalog * existed, or an issue_key this catalog hasn't been updated to include yet) * falls back to `get_or_fallback()`'s generic entry built from the row's own * `message` — never fatals, per the TZ's own "якщо ключ невідомий каталогу — * показувати message з бази і не падати" requirement. * * @package ABDS_SEO */ if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Static lookup table: issue_key -> explanatory text for the Audit report. */ class ABDS_SEO_Issue_Catalog { const FIX_POST = 'post'; const FIX_THEME = 'theme'; const FIX_HOSTING = 'hosting'; const FIX_SETTINGS_GENERAL = 'settings:abds-seo-settings-general'; /** * Returns the catalog entry for one issue_key, or a safe generic * fallback built from $fallback_message when the key isn't in this * catalog (never fatals — the TZ's own explicit requirement). * * @param string $issue_key Audit issue_key, e.g. 'missing_alt'. * @param string $fallback_message The row's own stored `message`, used verbatim when $issue_key is unknown. * @return array{title:string, why:string, how_to_fix:string, fix_location:string, docs_url:string} */ public static function get( string $issue_key, string $fallback_message = '' ): array { /** * Lets an add-on contribute catalog entries for the issue_keys its * own audit checks (the abds_seo_audit_checks filter) emit -- without * one, those keys render with the generic fallback below (title = * raw message, no "why", no fix guidance). Same entry shape as the * built-in ones; a built-in key can't be overridden by accident * only if the add-on uses its own prefixed keys (abds-seo-pro's are * all `index_*`). * * @since 0.13.0 * * @param array $entries Catalog entries by issue_key. */ $entries = (array) apply_filters( 'abds_seo_issue_catalog_entries', self::entries() ); if ( isset( $entries[ $issue_key ] ) ) { return $entries[ $issue_key ]; } return array( 'title' => '' !== $fallback_message ? $fallback_message : $issue_key, 'why' => '', 'how_to_fix' => '' !== $fallback_message ? $fallback_message : __( 'No further guidance is available for this issue yet.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ); } /** * The full catalog, built fresh on each call (translated strings can't * be cached in a class constant — `__()` needs the current locale * already loaded, which isn't guaranteed at class-definition time). * * @return array */ protected static function entries(): array { return array( // --- Service/engine-level (ABDS_SEO_Audit_Engine, ABDS_SEO_Audit_Check_Content) --- 'fetch_failed' => array( 'title' => __( 'Page could not be loaded for checking', 'abds-seo' ), 'why' => __( 'The audit could not fetch this page at all, so none of its other checks could run — this often means real visitors or search engines hit the same failure.', 'abds-seo' ), 'how_to_fix' => __( 'Open the page yourself in a browser. If it doesn\'t load, check your hosting error log or contact your host; if it loads fine for you, run the audit again — it may have been a temporary timeout.', 'abds-seo' ), 'fix_location' => self::FIX_HOSTING, 'docs_url' => '', ), 'no_focus_keyword' => array( 'title' => __( 'No focus keyword set', 'abds-seo' ), 'why' => __( 'Without a focus keyword, content analysis (keyword placement, density, readability against that keyword) can\'t run for this page at all.', 'abds-seo' ), 'how_to_fix' => __( 'Open the page in the editor and set a focus keyword in the SEO panel.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), // --- Technical (ABDS_SEO_Site_Scanner via ABDS_SEO_Audit_Check_Technical) --- 'missing_title' => array( 'title' => __( 'Missing page title', 'abds-seo' ), 'why' => __( 'The title tag is one of the strongest ranking and click-through signals — a page without one is far less likely to be shown or clicked in search results.', 'abds-seo' ), 'how_to_fix' => __( 'Open the page in the editor and set an SEO title in the SEO panel.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'title_too_long' => array( 'title' => __( 'Title is too long', 'abds-seo' ), 'why' => __( 'Search engines truncate long titles in results, often cutting off the most important words.', 'abds-seo' ), 'how_to_fix' => __( 'Shorten the SEO title to under 60 characters, keeping the most important words near the start.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'missing_meta_description' => array( 'title' => __( 'Missing meta description', 'abds-seo' ), 'why' => __( 'Without a meta description, search engines generate their own snippet from the page — usually less compelling and less likely to earn a click.', 'abds-seo' ), 'how_to_fix' => __( 'Open the page in the editor and write a meta description in the SEO panel.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'description_too_long' => array( 'title' => __( 'Meta description is too long', 'abds-seo' ), 'why' => __( 'Search engines truncate long descriptions in results.', 'abds-seo' ), 'how_to_fix' => __( 'Shorten the meta description to under 160 characters.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'missing_h1' => array( 'title' => __( 'Missing H1 heading', 'abds-seo' ), 'why' => __( 'The H1 tells both readers and search engines what the page is about — without one, the page\'s main topic is unclear.', 'abds-seo' ), 'how_to_fix' => __( 'Add exactly one H1 heading to the page content, describing what the page is about.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'multiple_h1' => array( 'title' => __( 'Multiple H1 headings', 'abds-seo' ), 'why' => __( 'More than one H1 confuses which heading is the page\'s actual main topic.', 'abds-seo' ), 'how_to_fix' => __( 'Keep only one H1 heading; change the others to H2 or lower.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'missing_alt' => array( 'title' => __( 'Image missing alt text', 'abds-seo' ), 'why' => __( 'Alt text lets search engines (and screen readers) understand what an image shows — without it, the image contributes nothing to the page\'s SEO and is inaccessible to visually impaired visitors.', 'abds-seo' ), 'how_to_fix' => __( 'Open the page in the editor and add descriptive alt text to the image(s) missing it.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'missing_canonical' => array( 'title' => __( 'Missing canonical URL', 'abds-seo' ), 'why' => __( 'Without a canonical tag, search engines may treat this page as duplicate content if the same content is reachable from more than one URL, splitting its ranking signals.', 'abds-seo' ), 'how_to_fix' => __( 'This is normally generated automatically. If it\'s missing, another SEO plugin or your theme may be blocking it — deactivate other SEO plugins and check again.', 'abds-seo' ), 'fix_location' => self::FIX_THEME, 'docs_url' => '', ), 'thin_content' => array( 'title' => __( 'Thin content', 'abds-seo' ), 'why' => __( 'A page with very little text usually can\'t cover its topic well enough to rank, compared to more thorough pages on the same subject.', 'abds-seo' ), 'how_to_fix' => __( 'Expand the page with more substantive, relevant content.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'schema_invalid_article' => array( 'title' => __( 'Invalid Article structured data', 'abds-seo' ), 'why' => __( 'Invalid structured data can be ignored by search engines or shown incorrectly in rich results.', 'abds-seo' ), 'how_to_fix' => __( 'Check that the page has the fields Article structured data requires (e.g. a title and a featured image), then run the audit again.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'schema_invalid_product' => array( 'title' => __( 'Invalid Product structured data', 'abds-seo' ), 'why' => __( 'Invalid structured data can be ignored by search engines or shown incorrectly in rich results.', 'abds-seo' ), 'how_to_fix' => __( 'Check that the page has the fields Product structured data requires (e.g. a price and availability), then run the audit again.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'schema_invalid_faqpage' => array( 'title' => __( 'Invalid FAQ structured data', 'abds-seo' ), 'why' => __( 'Invalid structured data can be ignored by search engines or shown incorrectly in rich results.', 'abds-seo' ), 'how_to_fix' => __( 'Check that every question on the page has a matching answer, then run the audit again.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'schema_invalid_breadcrumblist' => array( 'title' => __( 'Invalid breadcrumb structured data', 'abds-seo' ), 'why' => __( 'Invalid structured data can be ignored by search engines or shown incorrectly in rich results.', 'abds-seo' ), 'how_to_fix' => __( 'Check the page\'s breadcrumb trail for a broken or missing step, then run the audit again.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'schema_invalid_localbusiness' => array( 'title' => __( 'Invalid LocalBusiness structured data', 'abds-seo' ), 'why' => __( 'Invalid structured data can be ignored by search engines or shown incorrectly in rich results.', 'abds-seo' ), 'how_to_fix' => __( 'Check your business name, address, and phone number in the plugin\'s settings, then run the audit again.', 'abds-seo' ), 'fix_location' => self::FIX_SETTINGS_GENERAL, 'docs_url' => '', ), // --- Whole-page structured data (ABDS_SEO_Audit_Check_Schema) --- 'schema_missing' => array( 'title' => __( 'No structured data on the page', 'abds-seo' ), 'why' => __( 'Structured data tells search engines what the page and the site are. Without any, the page cannot qualify for rich results and search engines have to guess at the site\'s identity.', 'abds-seo' ), 'how_to_fix' => __( 'ABDS SEO prints structured data automatically. If it is missing, check that no theme or plugin setting turns structured data off, then run the audit again.', 'abds-seo' ), 'fix_location' => self::FIX_THEME, 'docs_url' => '', ), 'schema_graph_broken' => array( 'title' => __( 'Structured data refers to something it does not describe', 'abds-seo' ), 'why' => __( 'When the markup points at an item that is not described, or describes the same item twice, search engines may drop it or read it wrongly.', 'abds-seo' ), 'how_to_fix' => __( 'This is usually caused by a theme or another plugin adding or changing structured data. If you use the abds_seo_schema_graph filter, make sure every @id stays unique and every reference points at an item that exists; otherwise switch off the other source\'s structured data.', 'abds-seo' ), 'fix_location' => self::FIX_THEME, 'docs_url' => '', ), 'schema_conflict' => array( 'title' => __( 'Two sources describe the same thing', 'abds-seo' ), 'why' => __( 'When two sources both describe the organization, the website or the page itself, search engines pick one of them and may use the less complete one.', 'abds-seo' ), 'how_to_fix' => __( 'Keep a single source. Switch off structured data in your theme or in the other plugin — those settings live there; ABDS SEO never changes another plugin\'s output.', 'abds-seo' ), 'fix_location' => self::FIX_THEME, 'docs_url' => '', ), 'schema_type_invalid' => array( 'title' => __( 'Unsupported schema type for this content type', 'abds-seo' ), 'why' => __( 'The saved schema type is not one ABDS SEO can print, so it is ignored and the default type is used instead — which may not describe these pages correctly.', 'abds-seo' ), 'how_to_fix' => __( 'Open ABDS SEO → Search Appearance → Content Types, choose a supported schema type for this content type (Article, NewsArticle, BlogPosting, WebPage, AboutPage, ContactPage, CollectionPage or ItemPage) and save.', 'abds-seo' ), 'fix_location' => self::FIX_THEME, 'docs_url' => '', ), 'schema_other_plugin' => array( 'title' => __( 'Another SEO plugin controls structured data', 'abds-seo' ), 'why' => __( 'To avoid two competing descriptions of your site, ABDS SEO prints no structured data of its own while another SEO plugin is active. The structured data on this page comes from that plugin, and ABDS SEO\'s own structured-data settings (organization, schema type, breadcrumbs) have no effect.', 'abds-seo' ), 'how_to_fix' => __( 'Keeping one SEO plugin is the safest setup. To use ABDS SEO\'s structured data instead, deactivate the other plugin\'s structured-data output (or the plugin itself). Nothing is switched off automatically.', 'abds-seo' ), 'fix_location' => self::FIX_THEME, 'docs_url' => '', ), // --- Content analyzer (ABDS_SEO_Content_Analyzer via ABDS_SEO_Audit_Check_Content) --- 'content_title' => array( 'title' => __( 'Focus keyword missing from the title', 'abds-seo' ), 'why' => __( 'The title is one of the strongest signals of what a page is about — leaving out the focus keyword weakens that signal.', 'abds-seo' ), 'how_to_fix' => __( 'Work the focus keyword naturally into the SEO title.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'content_h1' => array( 'title' => __( 'Focus keyword missing from a subheading', 'abds-seo' ), 'why' => __( 'Keyword-relevant subheadings help both readers scanning the page and search engines understand its structure.', 'abds-seo' ), 'how_to_fix' => __( 'Add the focus keyword to at least one subheading.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'content_first_paragraph' => array( 'title' => __( 'Focus keyword missing from the first paragraph', 'abds-seo' ), 'why' => __( 'The opening paragraph is what readers and search engines see first — the focus keyword belongs there early.', 'abds-seo' ), 'how_to_fix' => __( 'Add the focus keyword to the first paragraph.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'content_subheading' => array( 'title' => __( 'Missing subheadings', 'abds-seo' ), 'why' => __( 'Subheadings break up long content, making it easier to scan and helping search engines understand the page\'s structure.', 'abds-seo' ), 'how_to_fix' => __( 'Add subheadings to break up the content.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'content_meta_description' => array( 'title' => __( 'Focus keyword missing from the meta description', 'abds-seo' ), 'why' => __( 'A meta description containing the focus keyword is more likely to match what the searcher typed, and search engines often bold matching terms in results.', 'abds-seo' ), 'how_to_fix' => __( 'Work the focus keyword naturally into the meta description.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'content_slug' => array( 'title' => __( 'Focus keyword missing from the URL', 'abds-seo' ), 'why' => __( 'A URL containing the focus keyword is a small but real relevance signal, and is clearer to readers who see the URL before clicking.', 'abds-seo' ), 'how_to_fix' => __( 'Work the focus keyword into the page\'s URL slug.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'content_image_alt' => array( 'title' => __( 'Focus keyword missing from image alt text', 'abds-seo' ), 'why' => __( 'Alt text containing the focus keyword reinforces the page\'s topic for image search and accessibility.', 'abds-seo' ), 'how_to_fix' => __( 'Add the focus keyword to an image\'s alt text where it genuinely describes the image.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'content_links' => array( 'title' => __( 'Missing outbound or internal links', 'abds-seo' ), 'why' => __( 'Links to relevant pages (yours or elsewhere) help both readers and search engines understand context and discover more content.', 'abds-seo' ), 'how_to_fix' => __( 'Add a relevant internal or outbound link to the content.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'content_content_length' => array( 'title' => __( 'Content is short', 'abds-seo' ), 'why' => __( 'Very short content usually can\'t cover a topic thoroughly enough to compete with longer, more complete pages.', 'abds-seo' ), 'how_to_fix' => __( 'Expand the content with more substantive, relevant text.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), 'content_content' => array( 'title' => __( 'Keyword density issue', 'abds-seo' ), 'why' => __( 'Using the focus keyword too often reads as spam to search engines; using it too rarely weakens the page\'s topical relevance.', 'abds-seo' ), 'how_to_fix' => __( 'Adjust how often the focus keyword appears in the content — add or remove occurrences so it reads naturally.', 'abds-seo' ), 'fix_location' => self::FIX_POST, 'docs_url' => '', ), ); } }