• 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_DB::insert() – Insert a new row

You appear to be a bot. Output may be restricted

Description

Insert a new row

Usage

EDD_DB::insert( $data, $type );

Parameters

$data
( mixed ) required –
$type
( mixed ) optional –

Returns

void int

Source

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

1 to 28 of 28
  public function insert( $data, $type = '' ) {
    global $wpdb;

    // Set default values
    $data = wp_parse_args( $data, $this->get_column_defaults() );

    do_action( 'edd_pre_insert_' . $type, $data );

    // Initialise column format array
    $column_formats = $this->get_columns();

    // Force fields to lower case
    $data = array_change_key_case( $data );

    // White list columns
    $data = array_intersect_key( $data, $column_formats );

    // Reorder $column_formats to match the order of columns given in $data
    $data_keys = array_keys( $data );
    $column_formats = array_merge( array_flip( $data_keys ), $column_formats );

    $wpdb->insert( $this->table_name, $data, $column_formats );
    $wpdb_insert_id = $wpdb->insert_id;

    do_action( 'edd_post_insert_' . $type, $wpdb_insert_id, $data );

    return $wpdb_insert_id;
  }
 

 View on GitHub View on Trac

Published: 26th November 2019 | Last updated: 26th November 2019

Primary Sidebar

Information

Function name: EDD_DB::insert
Class ref: EDD_DB
Plugin ref: Easy Digital Downloads
Version: 2.11.6
Sourcefile: includes/class-edd-db.php
File ref: includes/class-edd-db.php
Deprecated?: No
API Letters: D,E,I

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