• 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_Logging::insert_log() – Stores a log entry

You appear to be a bot. Output may be restricted

Description

Stores a log entry

Usage

$int = EDD_Logging::insert_log( $log_data, $log_meta );

Parameters

$log_data
( array ) optional – Log entry data
$log_meta
( array ) optional – Log entry meta

Returns

int The ID of the newly created log item

Source

File name: easy-digital-downloads/includes/class-edd-logging.php


Lines:

1 to 33 of 33
  function insert_log( $log_data = array(), $log_meta = array() ) {
    $defaults = array(
      'post_type'    => 'edd_log',
      'post_status'  => 'publish',
      'post_parent'  => 0,
      'post_content' => '',
      'log_type'     => false,
    );

    $args = wp_parse_args( $log_data, $defaults );

    do_action( 'edd_pre_insert_log', $log_data, $log_meta );

    // Store the log entry
    $log_id = wp_insert_post( $args );

    // Set the log type, if any
    if ( $log_data['log_type'] && $this->valid_type( $log_data['log_type'] ) ) {
      wp_set_object_terms( $log_id, $log_data['log_type'], 'edd_log_type', false );
    }

    // Set log meta, if any
    if ( $log_id && ! empty( $log_meta ) ) {
      foreach ( (array) $log_meta as $key => $meta ) {
        update_post_meta( $log_id, '_edd_log_' . sanitize_key( $key ), $meta );
      }
    }

    do_action( 'edd_post_insert_log', $log_id, $log_data, $log_meta );

    return $log_id;
  }
 

 View on GitHub View on Trac

Published: 26th November 2019 | Last updated: 17th June 2022

Primary Sidebar

Information

Function name: EDD_Logging::insert_log
Class ref: EDD_Logging
Plugin ref: Easy Digital Downloads
Version: 2.11.6
Sourcefile: includes/class-edd-logging.php
File ref: includes/class-edd-logging.php
Deprecated?: No
API Letters: E,I,L

Footer

Easy Digital Downloads a2z
Easy Digital Downloads a2z
Easy Digital Downloads a2z
WordPress 6.0.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:  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