Skip to content
Accueil » How to Add Schema.org Manually Without a Plugin in WordPress

How to Add Schema.org Manually Without a Plugin in WordPress

    Have you ever heard of Schema.org? If not, you’re not alone. Schema.org is a standardized format for marking up webpages with structured data. It’s used to help search engines understand what your website is all about. Structured data can also help search engines rank your content more effectively. If you’re a WordPress user, you may be wondering if there’s a way to add Schema.org without using a plugin.

    The good news is that you can add Schema.org to your website without using a third-party. In this article, we’ll show you how to add Schema.org manually in WordPress.

    Why Add Schema.org Markup to WordPress?

    Schema.org is a widely adopted standard for marking up webpages with structured data. It’s used widely by search engines to better understand the content on a page. Structured data can also help search engines to display more detailed information about your website on search engine result pages (SERPs).

    Adding structured data to your WordPress website can have multiple benefits. It can help search engines to index and rank your website more accurately. Structured data can also help your content to be displayed more prominently in search engine result pages (SERPs). It can also be used to add rich snippets to your website which can help to attract more clicks from potential visitors.

    If you want to take advantage of the benefits of structured data, then adding Schema.org markup to your WordPress website is a must. But how do you do it?

    How to Add Schema.org Manually in WordPress

    Adding Schema.org manually in WordPress is not that difficult. All you need to do is add the appropriate code to your website’s source code. Let’s take a look at the steps you need to follow.

    Step 1: Choose a Schema.org Markup Type

    The first step is to decide which Schema.org markup type you want to use. There are several different types of Schema.org markup, including:

    • Local Business Schema
    • Organization Schema
    • BlogPosting Schema
    • HowTo Schema
    • Product Schema
    • Event Schema

    You can find a complete list of all the available Schema.org markup types here. Depending on your needs, you should choose the appropriate markup type.

    Step 2: Generate the Schema.org Code

    Once you’ve chosen the appropriate Schema.org markup type, you’ll need to generate the code. You can use a tool such as TechnicalSEO.com’s Schema Markup Generator to generate the code. You just need to enter the appropriate information and the code will be generated for you.

    Step 3: Add the Schema.org Code to Your WordPress Website

    Once you have the code, you’ll need to add it to your WordPress website. Of course, there are plenty plugins allowing to introduce Schema to your WordPress, but most of them copy the schema in the header of your website, so well you cannot have a proper Schema for specific Page or Posts.

    Step 3-A : Enable Custom Fields in Posts :

    Firstly, you need to enable the custom fields for Posts, follow the 2 next steps. Start a new post or open an existing one to open the Options Panels (see below)

    Go to Preferences

    Now you can access to the Preferences and select Panels to activate the options Custom Fields

    Enable Custom Fields

    Once activated, you’ll see new fields appearing below your Posts :

    Custom Fields inside Edit Post

    Now you can Add Custom Field with the name Schema and Value corresponding to the actual schema you want to use.

    Step 3-B : Map the Custom field inside header

    Now this step is more technical, but easy to understand. To display a post, WordPress is populating a template page with properties coming from your Database (for instance the content of your post, the tags). In order to add the Schema.org to your posts, you need to tell WordPress to map the Custom Fields inside the header of your blog post :

    In Appearance, go to Theme File Editor

    Now select the header.php inside the Theme Files :

    Theme Files Explorer

    Add the following PHP code inside the header, before the closing Tag </head>

    	<?php
    	$schema = get_post_meta(get_the_ID(), 'schema', true);
    
    	if(!empty($schema)) {
    		echo $schema;
    	}
    	?>	

    What does mean this code :

    • If among all Custom Fields, there is one with ‘schema’
    • Then write the Value of the Custom Field inside the header

    You should see :

    Maybe you already understand that, but this method is not limited to the schema, we could easily add others metadata inside your HTML (header, footer, body). This method is useful and easy to use and is also valid to add description, OG tag, custom metadata, custom script or even Google Tag Manager.

    Step 4: Test Your Schema.org Markup

    Once you’ve added the code to your WordPress website, you’ll need to test it. You can use a tool such as Google’s Structured Data Testing Tool to do this. Just enter the URL of the page you want to test and the tool will show you if the code is working or not.

    Conclusion

    Adding Schema.org markup to your WordPress website is a great way to improve your website’s search engine rankings and attract more visitors. It’s fairly easy to add Schema.org markup manually in WordPress. All you need to do is choose a Schema.org markup type, generate the code, add it to your website , and then test it using a tool such as Google’s Structured Data Testing Tool.

    We hope this article helped you learn how to add Schema.org manually in WordPress.

    Leave a Reply

    Your email address will not be published. Required fields are marked *