• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Easy Digital Downloads a2z

Easy Digital Downloads a2z

Easy Digital Downloads a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / EDD_Payment::get_meta() – Get a post meta item for the payment

You appear to be a bot. Output may be restricted

Description

Get a post meta item for the payment

Usage

$mixed = EDD_Payment::get_meta( $meta_key, $single );

Parameters

$meta_key
( string ) optional default: _edd_payment_meta – The Meta Key
$single
( boolean ) optional default: 1 – Return single item or array

Returns

mixed The value from the post meta

Source

File name: easy-digital-downloads/includes/payments/class-edd-payment.php
Lines:

1 to 47 of 47
  public function get_meta( $meta_key = '_edd_payment_meta', $single = true ) {

    $meta = get_post_meta( $this->ID, $meta_key, $single );
    if ( $meta_key === '_edd_payment_meta' ) {

      if ( empty( $meta ) ) {
        $meta = array();
      }

      // #5228 Fix possible data issue introduced in 2.6.12
      if ( is_array( $meta ) && isset( $meta[0] ) ) {
        $bad_meta = $meta[0];
        unset( $meta[0] );

        if ( is_array( $bad_meta ) ) {
          $meta = array_merge( $meta, $bad_meta );
        }

        update_post_meta( $this->ID, '_edd_payment_meta', $meta );
      }

      // Payment meta was simplified in EDD v1.5, so these are here for backwards compatibility
      if ( empty( $meta['key'] ) ) {
        $meta['key'] = $this->setup_payment_key();
      }

      if ( empty( $meta['email'] ) ) {
        $meta['email'] = $this->setup_email();
      }

      if ( empty( $meta['date'] ) ) {
        $meta['date'] = get_post_field( 'post_date', $this->ID );
      }

    }

    $meta = apply_filters( 'edd_get_payment_meta_' . $meta_key, $meta, $this->ID );

    if ( is_serialized( $meta ) ) {
      preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $meta, $matches );
      if ( ! empty( $matches ) ) {
        $meta = array();
      }
    }

    return apply_filters( 'edd_get_payment_meta', $meta, $this->ID, $meta_key );
  }
 

 View on GitHub View on Trac

Published: 26th November 2019 | Last updated: 6th June 2020

Primary Sidebar

Information

Function name: EDD_Payment::get_meta
Class ref: EDD_Payment
Plugin ref: Easy Digital Downloads
Version: 2.11.6
Sourcefile: includes/payments/class-edd-payment.php
File ref: includes/payments/class-edd-payment.php
Deprecated?: No
API Letters: E,G,M,P

Footer

Easy Digital Downloads a2z
Easy Digital Downloads a2z
Easy Digital Downloads a2z
WordPress 5.9.3
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:  edd.wp-a2z.org
© Copyright Easy Digital Downloads a2z 2014-2022. All rights reserved.


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

  • Home
  • Blog
  • Sitemap
  • Sites