• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Yoast SEO a2z

Yoast SEO a2z

WordPress SEO a2z

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Meta::create_json_field() – Converts a presenter’s key and value to JSON.

You appear to be a bot. Output may be restricted

Description

Converts a presenter's key and value to JSON.

Usage

$object|null = Meta::create_json_field( $presenter );

Parameters

$presenter
( Abstract_Indexable_Presenter ) required – The presenter whose key and value are to be converted to JSON.

Returns

object|null

Source

File name: wordpress-seo/src/surfaces/values/meta.php
Lines:

1 to 15 of 15
  protected function create_json_field( $presenter ) {
    if ( $presenter->get_key() === 'NO KEY PROVIDED' ) {
      return null;
    }

    $value = $presenter->get();
    if ( empty( $value ) ) {
      return null;
    }

    return (object) [
      'key'   => $presenter->escape_key(),
      'value' => $value,
    ];
  }
 

 View on GitHub View on Trac

Published: 12th September 2021 | Last updated: 12th September 2021

Primary Sidebar

Information

Function name: Meta::create_json_field
Class ref: Meta
Plugin ref: Yoast SEO
Version: 19.9
Sourcefile: src/surfaces/values/meta.php
File ref: src/surfaces/values/meta.php
Deprecated?: No
API Letters: C,F,J,M

Footer

Yoast SEO a2z
Yoast SEO a2z
WordPress SEO a2z
WordPress 6.1.1
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wordpress-seo.wp-a2z.org
© Copyright Yoast SEO a2z 2017-2023. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites