Halloween Sale 15% off Ends in See the plans
PHP

Person Structured Data for a Personal Brand

Adds Person JSON-LD describing you (name, job title, photo, employer and social profiles) to your About page and homepage, for personal sites and portfolios.

Don’t have WPIDE yet? Install it on your site

Code

// Your details.
$wpide_person = array(
    'name'      => 'Jane Doe',
    'job_title' => 'Freelance Web Designer',
    'image'     => home_url( '/wp-content/uploads/jane-doe.jpg' ),
    'works_for' => 'Doe Studio',
    'same_as'   => array( 'https://www.linkedin.com/in/janedoe', 'https://github.com/janedoe' ),
    'about'     => 'about', // Slug of your About page.
);

add_action( 'wp_head', function () use ( $wpide_person ) {
    if ( ! is_front_page() && ! is_page( $wpide_person['about'] ) ) {
        return;
    }

    $data = array(
        '@context' => 'https://schema.org',
        '@type'    => 'Person',
        '@id'      => home_url( '/#person' ),
        'name'     => $wpide_person['name'],
        'url'      => home_url( '/' ),
        'jobTitle' => $wpide_person['job_title'],
        'image'    => $wpide_person['image'],
        'sameAs'   => array_values( array_filter( $wpide_person['same_as'] ) ),
    );

    if ( $wpide_person['works_for'] ) {
        $data['worksFor'] = array( '@type' => 'Organization', 'name' => $wpide_person['works_for'] );
    }

    echo '<script type="application/ld+json">' . wp_json_encode( array_filter( $data ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_HEX_TAG ) . "</script>\n";
} );

Notes

Fill in your details and the slug of your About page. Use Organization schema instead if the site represents a company.

How to add this snippet

  1. Install WPIDE on your WordPress site (it is free) and open Code Snippets.
  2. Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
  3. It is added inactive: review the code and settings, then switch it on.

Have a snippet worth sharing?

Publish it to the library from WPIDE or right here. Sign in with any WordPress site that runs WPIDE, free or Pro. Public snippets are reviewed by the WPIDE team before they appear.

Which site should get this snippet?

Enter the address of your WordPress site. WPIDE opens there in a new tab with the snippet ready to review and save.

Remembered in this browser only, so you are asked once.

Report this snippet

Tell the WPIDE team what is wrong: broken code, something harmful, spam or copied work.