$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Inserting Schema Markup (JSON-LD) Manually with Custom Fields or any Better Ways?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Inserting Schema Markup (JSON-LD) Manually with Custom Fields or any Better Ways?

matteradmin7PV0评论

what is a simple and reliable way to insert schema markup (JSON-LD) in my static WP pages manually? My question is not about creating the JSON-LD code, but how to implement it in the WP source code. I don't want to use a plugin or the Google Tag Manager.

JSON-LD markup is a script tag, which actually does not contain executable JavaScript as far as I know. It's meta data which should not show up on front page, it's information for search engines and looks like this:

    <script type="application/ld+json">
{
  "@context": "",
  "@type": "LocalBusiness",
  "address": {
    "@type": "PostalAddress",
    "addressLocality": "Mexico Beach",
    "addressRegion": "FL",
    "streetAddress": "3102 Highway 98"
  },
  "description": "A superb collection of fine gifts and clothing to accent your stay in Mexico Beach.",
  "name": "Beachwalk Beachwear & Giftware",
  "telephone": "850-648-4200"
}
</script> 

Some blogs in the web suggest to create a WP custom field.

Is this really the best way to do it manually and why?

At the moment I'm not sure where to place the code. In the head it may slow user visible loading time, but gives the JSON-code a clearly separated place from the important body source code. May be just before closing body-tag would be a nice place too. Can I decide where to place it by using custom fields and how?

Thanks,

Martin

Post a comment

comment list (0)

  1. No comments so far