Discover the Secret to Plugin-Free Schema Markup - 3 Hacks

By: Einovex
Last Updated: June 14, 2023
Rich snippet graphical structure

Are you looking to add Schema markup to your WordPress website, but you don’t want to rely on a plugin?

I totally get that, and I’ve been there too! That’s why I decided to write this blog post, sharing my personal experience and the methods I’ve found to be most effective. I’m going to walk you through a step-by-step process that’s not only easy to understand, but also easy to implement—even if you’re a beginner.

By the end of this post, I’m confident you’ll be able to add Schema markup to your WordPress site like a pro, helping you improve its visibility and potentially boost its search engine ranking

3 easy ways to add schema markup to WordPress without plugin

  • Using block editor (My Recommendation)
  • Using child theme
  • Using Google tag manager

Add schema markup using block editor

First, make sure you’re logged into your WordPress admin dashboard. Once you’re in, navigate to the page or post where you want to add schema markup.

Next, click on the “Edit” button to open the block editor. If you haven’t used the block editor before, it’s a powerful and flexible tool that allows you to create and edit content in a more dynamic way than the classic editor.

Now, you’ll want to add a new block to the page. To do this, click on the “+” icon in the editor, and search for the “Custom HTML” block. Add this block to your page.

In the Custom HTML block, you can now add your schema markup code. If you’re not sure what schema markup code to use, you can check out

If everything looks good and there are no errors, go ahead and save your page or post by clicking on the “Update” button in the block editor. And that’s it! You’ve successfully added schema markup to your WordPress site using the block editor.

Video Guide

Add schema markup using child theme

Adding schema markup to a WordPress site using a child theme is quite straightforward. With a child theme, you can modify the underlying code without affecting the parent theme, making it an efficient and safe method to incorporate schema markup.

This typically involves editing the child theme’s file and embedding the relevant JSON-LD structured data.

Just follow the mentioned steps or you can follow the video guide:

Create a child theme:

First and foremost, you need to have a child theme set up on your WordPress site. If you don’t already have one, you can create a child theme by following these steps:

  • Create a new folder in your wp-content/themes directory and name it something like ‘my-theme-child’.
  • Create a ‘style.css’ file inside the newly created folder and add the necessary header comment to link it to your parent theme. For example:
				
					 "/*
Theme Name: My Theme Child
Template: my-theme
*/"

				
			
  • Create a ‘functions.php’ file in the same folder and add the following code to enqueue the parent and child theme styles:
				
					        <?php
// Enqueue parent and child theme styles
function enqueue_child_theme_styles() {
    // Enqueue parent theme styles
    wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
    
    // Enqueue child theme styles
    wp_enqueue_style('child-style', get_stylesheet_directory_uri() . '/style.css', array('parent-style'));
}
add_action('wp_enqueue_scripts', 'enqueue_child_theme_styles');

				
			
  • Activate the child theme from your WordPress dashboard by going to Appearance > Themes and selecting your new child theme.

Add schema markup

Now that you have a child theme set up, you can add schema markup to your site. There are two ways to do this: manually or using a plugin. I personally recommend using a plugin, as it’s more user-friendly and less error-prone.

However, I’ll explain both methods for your convenience.

  • Identify the content type for which you want to add schema markup. It could be an article, a product, a recipe, etc. You can find the appropriate schema markup at schema.org
  • Copy the relevant schema markup code and paste it into your child theme’s ‘functions.php’ file. Make sure to modify the code as needed to represent your content accurately.
  • Save the ‘functions.php’ file and refresh your site to see the changes.

Video Guide

Add schema markup using GTM

  • Create a Google Tag Manager account: If you haven’t already, you’ll need to create a Google Tag Manager account.
  • Set up the Google Tag Manager container: Once you’ve got the plugin installed, you’ll need to paste your Google Tag Manager container ID into the plugin settings. This will connect your WordPress site to Google Tag Manager and enable you to start adding schema markup.
  • Choose your schema markup: Now, you’ll need to decide which schema markup you want to add to your site. There are tons of different options to choose from – for example, you might want to add schema markup for articles, recipes, or events. 
  • I’d suggest checking out “<script type=”application/ld+json”>” tag, so that it’s properly recognized by search engines.
  • Add a trigger: To ensure that your schema markup is added to the appropriate pages on your site, you’ll need to set up a trigger. In the Google Tag Manager dashboard, click on “Triggers” in the left-hand menu, and create a new trigger that’s appropriate for your chosen schema markup. For example, if you’re adding article schema markup, you could create a trigger that fires on all blog post pages.
  • Preview and test your tag: Before you publish your new tag, I’d recommend previewing it to ensure that it’s working as expected. In the Google Tag Manager dashboard, click the “Preview” button, and then visit your site to check that the schema markup has been added to the relevant pages.

Video Guide

What's Next

As a next step, I personally recommend assessing your current level of expertise and comfort with WordPress. If you’re a beginner or prefer a more straightforward approach, using the Block Editor would be a great choice.

However, if you have experience with web development or want more control over the implementation, exploring the Child Theme or Google Tag Manager methods could be more suitable for you.

Regardless of the method you choose, it’s essential to follow the instructions carefully and test your implementation to ensure everything works as expected.

Table of Contents