Content Moved? Use Search to Locate
A modern computer screen displaying web design work, showcasing creative visuals in a workspace.

Can Google Ignore CSS-Generated Text on WordPress?

Yes. Google may ignore text added through CSS-generated content. Google Search Central says content added with the CSS content property is not part of the DOM and may be ignored by Google Search. Decorative uses—such as quotation marks, icons, counters, and visual flourishes—can remain in CSS, but business-critical information should be present in semantic HTML.

This matters to WordPress developers, SEOs, designers, and small-business site operators whose pages use ::before, ::after, or data attributes to display service areas, prices, badges, product attributes, or calls to action. The practical fix is not to remove all generated content. It is to identify meaning that exists only in CSS and move that meaning into the page markup.

What CSS-generated text is—and is not

A stylesheet can insert text before or after an element without adding that text to the page’s normal HTML. For example:

.service-area::after {
  content: "Serving Example County";
}

A browser may visibly display “Serving Example County,” but that does not mean the phrase exists as a text node in the document. MDN explains that generated content from the CSS content property is not included in the DOM and is not consistently represented in the accessibility tree.

That is different from ordinary HTML:

<p class="service-area">
  Serving Example County
</p>

The second example gives the phrase a normal place in the document. It can then be styled, inspected, translated, and maintained as page content.

It is also different from JavaScript-rendered content. JavaScript can add or change DOM nodes after the initial HTML is delivered. Google’s guidance here specifically addresses text supplied through the CSS content property; do not assume that CSS-generated content and JavaScript-rendered content have identical search behavior.

Google’s SEO Guide for Web Developers recommends making important text accessible in the DOM and using semantic HTML. It also says that visual content should have useful text context. That is the relevant basis for this WordPress cleanup.

Decide what must move into HTML

Use this distinction before changing a theme or page-builder component:

Content type Examples Recommended treatment
Decorative content Quotation marks, icon glyphs, borders, separators, visual counters, ornamental arrows CSS-generated content is usually appropriate when removing it does not remove meaning or usability.
Repeated interface labels “Read more,” “Menu,” “Open,” or a status label repeated across cards Prefer HTML when the label communicates an action or state. An icon can remain decorative, but the usable label should not depend only on CSS.
Business-critical information Headings, calls to action, service areas, prices, availability, product attributes, offer terms, shipping conditions Put the actual words in semantic HTML. Use CSS for layout and presentation.

A useful test is simple: if a customer, screen-reader user, translator, search system, or site editor needs the information to understand or act on the page, do not make CSS responsible for supplying the words.

How to find CSS-generated business text

Run this inspection on a representative page, then repeat it on templates and repeated components.

1. Start with visible, meaningful phrases

List text that affects the page’s meaning or a customer’s decision. On a local service page, that might include a county or service area. On a WooCommerce store, it could include a sale label, product attribute, price, availability statement, or offer condition.

Do not begin by searching for every use of content:. Many declarations are harmless decoration. Begin with words that matter to the business.

2. Inspect the element and its pseudo-elements

Open browser developer tools, select the visible phrase’s nearby element, and check the ::before and ::after entries in the Styles or Computed panel. Look for declarations such as:

content: "Serving Example County";
content: attr(data-badge);
content: "Sale";

Record the stylesheet, selector, breakpoint, and component that supplies the text. The source may be a theme stylesheet, child theme, page-builder asset, block pattern, WooCommerce override, or translated stylesheet.

3. Compare Elements with View Source

The Elements panel shows the current DOM after browser processing and scripts have run. View Source shows the HTML response that the browser received. Search both for the important phrase.

  • If the phrase appears in neither source nor DOM, but the browser displays it, CSS is a likely source.
  • If it appears in the DOM and CSS also adds a copy, check for duplicated accessible or visible text.
  • If it appears only after JavaScript changes the DOM, document that separately rather than treating it as CSS-generated content.

4. Disable CSS temporarily

Use the browser’s rendering or developer-tools controls to disable stylesheets, or use a clean test profile that prevents the relevant CSS from loading. The page does not need to look attractive in this test. Ask whether the important phrase remains understandable and whether the user can still identify the action or offer.

MDN specifically recommends checking that information critical to understanding a page remains available when CSS is disabled. This is a diagnostic check, not proof of how every search engine extracts content.

5. Inspect the accessibility tree

Use the browser’s Accessibility panel to inspect the selected element. Confirm that the meaningful label, state, or value is represented appropriately. Generated text is not consistently represented in the accessibility tree, so a phrase that disappears from this view deserves attention even if it is visible in the browser.

Accessibility and search checks overlap because both benefit from meaningful content in the document, but accessibility behavior alone does not establish a special rule for AI Overviews, AI Mode, or another generative search system.

6. Search loaded stylesheets

In developer tools, search the loaded CSS files for content:, ::before, and ::after. Also search the WordPress codebase when you have access to it. Include minified files, responsive rules, page-builder output, child-theme overrides, and translated assets.

Useful command-line searches on a local copy might include:

grep -R "content:" wp-content/themes/ wp-content/plugins/
grep -R "::before\|::after" wp-content/themes/ wp-content/plugins/

Do not assume that the first matching declaration is the production rule. Caching, concatenation, minification, localization, and breakpoint-specific styles can change which rule wins.

Hypothetical WordPress example: a service area

Scenario: A local service page visibly displays “Serving Example County” beneath its heading. The theme supplies it with this rule:

.service-area::after {
  content: "Serving Example County";
  display: block;
  margin-top: .5rem;
  color: #555;
}

The phrase is meaningful local-business information, not decoration. Move it into the page template, block, or page-builder component:

<h1>Emergency Plumbing Services</h1>
<p class="service-area">Serving Example County</p>

Then retain the presentation in CSS:

.service-area {
  display: block;
  margin-top: .5rem;
  color: #555;
}

This keeps the service-area phrase in the document while preserving the visual design. If the site serves multiple counties, populate the paragraph from the same maintainable WordPress field or block attribute used elsewhere. Do not leave one hard-coded CSS phrase in a stylesheet while changing the visible service-area copy in the editor.

After the change, check the desktop and mobile versions. A pseudo-element may have appeared only at a particular breakpoint, while the new paragraph may require its own spacing or visibility rules.

Hypothetical WooCommerce example: sale badges and product data

Scenario: A product card contains a data attribute:

<article class="product-card" data-badge="Sale">
  ...
</article>

CSS displays the badge:

.product-card::before {
  content: attr(data-badge);
  position: absolute;
  top: .75rem;
  left: .75rem;
}

A decorative badge shape can remain CSS-generated, but the offer information should not depend on it. Make the sale label, price, availability, product attributes, and offer terms part of the product-card or product-summary markup when they are relevant to the customer:

<article class="product-card">
  <span class="product-badge">Sale</span>
  <h2>Example Product</h2>
  <p class="price">$29.00</p>
  <p class="availability">In stock</p>
  <p class="attribute">Material: Cotton</p>
</article>

Then use CSS to position and style .product-badge. In WooCommerce, check the product-card template, loop markup, single-product summary, structured data output, and any theme override before editing. A visual badge is not a substitute for maintaining the underlying product information consistently.

Also avoid creating two competing copies of the same label—one in HTML and another in ::before or ::after—unless the generated copy is purely decorative and hidden appropriately. Duplicate text can create confusing visual or accessibility results.

How to verify the WordPress change

Use several forms of evidence. No single browser view proves what Google has indexed or how it will use a phrase.

  1. Check the HTML or rendered DOM. Search for the exact important phrase. It should exist as normal page content rather than only as a CSS declaration.
  2. Disable CSS. Confirm that the phrase remains understandable and that the user can still identify the service, product, price, state, or action.
  3. Inspect the accessibility tree. Confirm that the meaningful text or label is exposed appropriately. A decorative icon need not be announced as text.
  4. Test responsive output. Check desktop, tablet, and mobile breakpoints. Confirm that the HTML phrase is not hidden by a selector that was previously applied only to the pseudo-element.
  5. Retest translated and cached versions. Clear or bypass page caches, CDN caches, asset optimization, and minified CSS where appropriate. Check translated templates and language-specific stylesheets.
  6. Use URL Inspection in Search Console. Google’s URL Inspection Tool can show information about the indexed version and supports a live test, rendered-page inspection, loaded-resource review, JavaScript output review, and page-code views.

In URL Inspection, compare the indexed version with the live test when both are available. Review the rendered page and tested or crawled code for the phrase. A live test reflects the current test conditions; it does not rewrite or immediately replace the indexed version. Conversely, a successful inspection does not prove that Google will show the phrase in a result, rank the page for it, or use it in an AI-generated answer.

Google’s current documentation supports the CSS and DOM guidance above. It does not establish a separate CSS-generated-content rule for AI Overviews, AI Mode, Bing AI, or other generative search systems. Moving meaningful text into HTML is a sound maintainability, accessibility, and Google Search practice; it is not evidence of a guaranteed AI-search outcome.

WordPress and WooCommerce verification checklist

  • Identify headings, calls to action, service areas, prices, availability, product attributes, and offer terms that appear only through CSS.
  • Inspect ::before, ::after, content:, and attr() declarations in loaded stylesheets.
  • Compare browser Elements with View Source and distinguish CSS-generated text from JavaScript-added DOM content.
  • Move business-critical phrases into semantic HTML in the correct theme template, block pattern, page-builder widget, or WooCommerce template.
  • Retain CSS-generated content for decorative icons, quotation marks, counters, and presentational flourishes when they are not essential to meaning.
  • Check for duplicate text after adding the HTML version.
  • Inspect the accessibility tree and test with CSS disabled.
  • Test product cards, archives, single-product pages, and other repeated WooCommerce components.
  • Test desktop and mobile breakpoints, including rules that hide or reposition content.
  • Check child themes, WooCommerce overrides, page-builder output, translated stylesheets, minified assets, and cached or CDN-served CSS.
  • Run a clean URL Inspection live test and compare its evidence with the indexed version.
  • Record the inspected URL, cache state, device conditions, template version, and exact phrase so the test can be repeated after deployment.

For a final decision, ask one question: if the CSS file disappeared, would a customer still have the information needed to understand the page or make a decision? If not, put that information in HTML and let CSS handle the appearance.

Have you found meaningful WordPress or WooCommerce text hidden in a pseudo-element, page-builder rule, or product-card stylesheet? Share the component type and how you verified the replacement, without including private site details.

Sources

Editorial note: AI assists with research, drafting and automated checks. Sources are linked so you can verify the guidance. Platform requirements can change; confirm the details that apply to your setup.