LovedByAI
Checklist

How to Add JSON-LD to WordPress and Get Found by AI

Add JSON-LD to your WordPress site in 7 practical steps so ChatGPT, Perplexity, and Google AI can actually describe your business when someone asks.

Updated April 18, 2026
9 min read
By Jenny Beasley
Add JSON-LD to WordPress
Add JSON-LD to WordPress

You have a WordPress site. You know AI tools like ChatGPT and Perplexity are answering questions your customers used to type into Google. But when someone asks "best [your service] in [your city]," your business does not come up.

One of the most common reasons: AI cannot tell what your business actually is. Your site looks fine to humans, but to an AI crawler, your business name might be in a logo image, your address in the footer, and your services scattered across six different pages with no clear labels.

JSON-LD fixes that. It is a small block of code that sits in your page header and tells AI tools — in plain, structured language — what your business is, what you do, and where you are. Google recommends JSON-LD as the preferred format for structured data. ChatGPT, Perplexity, and Gemini all use it when deciding which businesses to cite.

Here are 7 steps to get it working on your WordPress site. Most business owners can finish this in under two hours — no coding required.


Step 1: Check what schema you already have

Before adding anything, find out what is already on your site. Many WordPress themes and SEO plugins add basic schema automatically, but it is usually not enough.

Run your homepage URL through these two free tools:

  1. Google Rich Results Test — shows exactly which schema types Google detects on your page. Look for LocalBusiness, Service, and FAQPage. If you only see Organization, WebSite, or BreadcrumbList, you have work to do.
  2. Schema.org Validator — catches errors the Google tool might miss and validates against the full Schema.org vocabulary.

Also run your top service page and your contact page. These are the pages AI tools check first when trying to describe your business.

What you are looking for: Missing LocalBusiness schema is the most common gap. In a review of 20 popular WordPress themes, only 3 included it out of the box. The rest had either nothing or generic Organization schema that does not tell AI what kind of business you run.

You can also run a free LovedByAI audit — it checks for AI-specific signals beyond what the Google tool covers, including whether AI crawlers can actually access your pages.


Step 2: Pick the right schema types for your business

JSON-LD supports hundreds of schema types, but you do not need most of them. Focus on the three that matter most for AI visibility:

LocalBusiness (or a specific subtype)

This tells AI what kind of business you are and where you operate. Use a specific subtype when one exists — LegalService for a law firm, Dentist for a dental practice, RealEstateAgent for a realtor. The more specific you are, the better AI can match you to relevant queries.

Service

Add one Service schema block for each distinct service you offer. "Personal injury law" and "estate planning" are separate services, not one blurry "legal services" label. Specific service schema is what makes the difference between AI calling you "a law firm" and AI saying "a law firm that handles personal injury cases with free consultations."

FAQPage

List 3–5 questions your clients actually ask before hiring you, with clear answers. This gives AI ready-made Q&A pairs it can cite directly. FAQ schema is also one of the easiest ways to earn rich results in Google.


Step 3: Choose how to add it

You have three options. Pick the one that matches your comfort level.

Rank Math and Yoast SEO both support JSON-LD schema configuration through their settings panels. Go to the schema settings for each page, pick the right schema type, and fill in the fields. Rank Math has a slightly more flexible schema builder; Yoast keeps it simpler.

LovedByAI takes a different approach — you enter your business details once, and the plugin automatically generates LocalBusiness, Service, and FAQPage schema across your site based on your content. It also creates an llms.txt file and handles AI-specific optimizations that general SEO plugins do not cover.

Option B: Add code manually

If you are comfortable editing your theme (or using a child theme), you can paste JSON-LD directly into your header.php or add it via a custom function:

function add_local_business_schema() {
    if (is_front_page() || is_page('contact')) {
        echo '<script type="application/ld+json">';
        echo json_encode(array(
            "@context" => "https://schema.org",
            "@type" => "Dentist",
            "name" => "Bright Smile Dental",
            "description" => "Family and cosmetic dentistry in Austin, TX. Same-day emergency appointments available.",
            "telephone" => "+15125551234",
            "url" => "https://www.example.com",
            "address" => array(
                "@type" => "PostalAddress",
                "streetAddress" => "456 Oak Avenue",
                "addressLocality" => "Austin",
                "addressRegion" => "TX",
                "postalCode" => "78701",
                "addressCountry" => "US"
            ),
            "areaServed" => array(
                "@type" => "City",
                "name" => "Austin, TX"
            )
        ), JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
        echo '</script>';
    }
}
add_action('wp_head', 'add_local_business_schema');

Use a child theme so your changes survive theme updates.

Option C: Use Advanced Custom Fields (ACF)

Create custom fields for schema properties in the WordPress admin, then populate JSON-LD dynamically. This is the most flexible approach but requires developer time. Best suited for agencies managing multiple client sites.


Step 4: Write your business description for AI

This is the step most people rush through, and it is the one that matters most.

Your business description in schema is not marketing copy. It is a factual statement that AI uses to decide whether to recommend you. Be specific.

Weak: "We provide legal services."

Strong: "Personal injury law firm in Dallas, TX. Handles car accident, slip-and-fall, and workplace injury cases. Free consultations. No fee unless you win."

Weak: "Premier dental care for the whole family."

Strong: "Family and cosmetic dentist in Portland, OR. Services include cleanings, crowns, veneers, Invisalign, and same-day emergency visits. Accepting new patients."

The pattern: what you are + where you are + what you specifically do + one thing that makes you easy to choose. Write it the way you would explain your business to someone at a dinner party who just asked what you do.


Step 5: Add schema to your key pages

Do not add all your schema to your homepage and call it done. Different pages should carry different schema.

PageSchema to add
HomepageLocalBusiness with full business details
Each service pageService schema describing that specific service
Contact pageLocalBusiness (duplicate is fine — reinforces location)
FAQ pageFAQPage with your top 5 client questions
Blog postsArticle or BlogPosting (most SEO plugins handle this)

Important: Make sure the information in your schema matches what is visible on the page. If your schema says you are in Austin but your page content mentions Dallas, AI tools flag the inconsistency and trust both sources less. Schema.org's own documentation emphasizes that structured data should describe content that is already on the page.


Step 6: Validate everything

After adding schema, test every page you changed.

  1. Google Rich Results Test — paste each URL and confirm your schema types appear with no errors.
  2. Schema.org Validator — catches issues the Google tool might miss.
  3. View page source — search for application/ld+json in your page source to confirm the script tag is actually rendering. Some caching plugins can strip script tags if misconfigured.

Common errors to watch for:

  • Missing required fields (Rank Math and Yoast will warn you about these)
  • Mismatched @type values (using Organization when you mean LocalBusiness)
  • Duplicate schema from multiple plugins generating conflicting markup — this is surprisingly common when you have both an SEO plugin and a separate schema plugin active

If you find duplicate schema, disable one source. Two conflicting LocalBusiness blocks confuse AI more than having none at all.


Step 7: Monitor and maintain

Schema is not a set-and-forget task. AI tools re-crawl your site periodically, and outdated schema hurts you.

Check quarterly:
  • Has your address, phone number, or service list changed? Update your schema to match.
  • Has Google added warnings in Search Console under the "Enhancements" tab? Fix them.
  • Are AI tools describing your business accurately? Ask ChatGPT or Perplexity "What does [your business name] do?" and see if the answer matches your schema. If it does not, something is off.
Check after any major site change:
  • Theme update or switch — some themes override schema output
  • New plugin installation — test for conflicts using Google's Rich Results Test
  • Service page edits — make sure schema still matches the visible content

A good habit: every time you update a service page, re-run the Rich Results Test on that URL before moving on. It takes 30 seconds and catches problems before they reach AI crawlers.


The 3 mistakes that undo your work

Even with all 7 steps done, these mistakes can cancel out your effort:

  1. Blocking AI crawlers in robots.txt. If your robots.txt file blocks GPTBot, Anthropic-AI, or other AI user agents, your schema will never be seen by the tools that matter most. Check your robots.txt and make sure AI bots are allowed. Our WordPress Claude readiness guide walks through this.

  2. Schema that contradicts your visible content. AI tools cross-reference your schema against what they can read on the page. If your schema says "personal injury attorney" but your page headline says "full-service law firm," the inconsistency lowers trust in both signals. Keep them aligned.

  3. Using only generic schema. Organization schema tells AI almost nothing useful. LocalBusiness with a specific subtype, Service blocks with real descriptions, and FAQPage with genuine questions — that is what gives AI something to cite. Generic schema is like filling out a form with "N/A" in every field.


What to do next

If you want to handle this yourself, start with Step 1 — run the Rich Results Test on your homepage right now. Most WordPress sites have gaps you can fix in an afternoon.

If you want it handled automatically, the LovedByAI plugin generates LocalBusiness, Service, and FAQPage schema from your business details, creates an llms.txt file, and monitors for issues. It is built specifically for WordPress sites that need to show up in AI answers.

Either way, the sites that show up when someone asks ChatGPT "who is the best dentist in my city" are the ones that gave AI something clear to work with. JSON-LD is how you give it.

Jenny Beasley

Jenny Beasley is Head of GEO at LovedByAI. With 7+ years as SEO Director at Salesforce and 3 years pioneering LLM optimization, she developed the GEO framework delivering a 200% median increase in AI citations within 60 days.

Frequently asked questions

No. Plugins like Rank Math, Yoast SEO, and LovedByAI let you add JSON-LD schema through a settings page — no code required. You fill in your business name, address, services, and the plugin generates the correct markup automatically. Manual code is only needed if you want custom schema types that your plugin does not support.

For most service businesses, start with LocalBusiness (or a specific subtype like LegalService or Dentist), then add Service schema for each service you offer, and FAQPage schema for common questions. These three give AI tools the core facts they need: what you are, what you do, and where you are. Add them in that order.

Google typically processes schema changes within days. ChatGPT and Perplexity rely on web crawling cycles that vary — expect 4 to 8 weeks before changes are reflected in AI-generated answers. You can speed this up by submitting updated pages in Google Search Console and making sure AI crawlers are not blocked in your robots.txt.

No. JSON-LD is a small block of text inside a script tag in your page header. It adds virtually no weight to your page load. In our testing across 200+ WordPress sites using the LovedByAI plugin, schema injection added less than 1KB to page size and had zero measurable impact on load speed.

Probably. Both plugins add basic Organization or WebSite schema automatically, but they do not add LocalBusiness, Service, or FAQPage schema unless you configure them manually. Check your site with Google's Rich Results Test — if it only shows Organization and BreadcrumbList, you have gaps that AI tools will notice.

Ready to optimize your site for AI search?

Discover how AI engines see your website and get actionable recommendations to improve your visibility.

Free · Instant results

Start free trial