• 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 / WPSEO_Utils::format_json_encode() – Prepares data for outputting as JSON.

You appear to be a bot. Output may be restricted

Description

Prepares data for outputting as JSON.

Usage

$false|string = WPSEO_Utils::format_json_encode( $data );

Parameters

$data
( array ) required – The data to format.

Returns

false|string The prepared JSON string.

Source

File name: wordpress-seo/inc/class-wpseo-utils.php
Lines:

1 to 17 of 17
  public static function format_json_encode( $data ) {
    $flags = ( JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );

    if ( self::is_development_mode() ) {
      $flags = ( $flags | JSON_PRETTY_PRINT );

      
/**
 * Filter the Yoast SEO development mode.
 *
 * @api array $data Allows filtering of the JSON data for debug purposes.
 */
      $data = apply_filters( 'wpseo_debug_json_data', $data );
    }

    // phpcs:ignore Yoast.Yoast.AlternativeFunctions.json_encode_wp_json_encodeWithAdditionalParams -- This is the definition of format_json_encode.
    return wp_json_encode( $data, $flags );
  }
 

 View on GitHub View on Trac

Published: 27th November 2019 | Last updated: 7th April 2022

Primary Sidebar

Information

Function name: WPSEO_Utils::format_json_encode
Class ref: WPSEO_Utils
Plugin ref: Yoast SEO
Version: 19.9
Sourcefile: inc/class-wpseo-utils.php
File ref: inc/class-wpseo-utils.php
Deprecated?: No
API Letters: E,F,J,U,W

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