Title: Adding &#039;sameas&#039; code to head or body
Last modified: August 31, 2016

---

# Adding 'sameas' code to head or body

 *  Resolved [wollyroger](https://wordpress.org/support/users/wollyroger/)
 * (@wollyroger)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/adding-sameas-code-to-head-or-body/)
 * Hi there,
 * I’d like to use the schema.org ‘sameas’ code in my website, but can’t seem to
   get it to work. In the google article it talks about adding the code to either
   the head or body:
 * [https://developers.google.com/structured-data/customize/social-profiles](https://developers.google.com/structured-data/customize/social-profiles)
 * I know i’d need to paste this into the functions.php of my child theme, but not
   sure exactly what code to use to get it working (i.e: add action ‘wp_head’ etc)
 * Can anyone help?
 * Thanks in advance

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Menaka S.](https://wordpress.org/support/users/menakas/)
 * (@menakas)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/adding-sameas-code-to-head-or-body/#post-6935545)
 * Add this to the functions.php of your child theme.
 *     ```
       <?php
         add_action('wp_head','my_code', 20);
         function my_code() {
           ?>
           /* Add script here */
           <?php
         }
       ?>
       ```
   
 *  Thread Starter [wollyroger](https://wordpress.org/support/users/wollyroger/)
 * (@wollyroger)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/adding-sameas-code-to-head-or-body/#post-6935556)
 * Thanks for this,
 * I found it worked if I removed the opening <?php (as this gave a syntax error).
   For reference, the full code read like this:
 *     ```
       add_action('wp_head','sameas_code', 20);
         function sameas_code() {
           ?>
           <script type="application/ld+json">
       {
         "@context" : "http://schema.org",
         "@type" : "Organization",
         "name" : "Your Organization Name",
         "url" : "http://www.your-site.com",
         "sameAs" : [
           "http://www.facebook.com/your-profile",
           "http://www.twitter.com/yourProfile",
           "http://plus.google.com/your_profile"
         ]
       }
       </script>
           <?php
         }
       ```
   
 *  [Menaka S.](https://wordpress.org/support/users/menakas/)
 * (@menakas)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/adding-sameas-code-to-head-or-body/#post-6935563)
 * HI,
    Can you mark this topic as resolved?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Adding 'sameas' code to head or body’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/customizr/4.4.24/screenshot.png)
 * Customizr
 * [Support Threads](https://wordpress.org/support/theme/customizr/)
 * [Active Topics](https://wordpress.org/support/theme/customizr/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/customizr/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/customizr/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Menaka S.](https://wordpress.org/support/users/menakas/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/adding-sameas-code-to-head-or-body/#post-6935563)
 * Status: resolved