Skip to content

Instantly share code, notes, and snippets.

@leowebguy
Created November 16, 2015 21:15
Show Gist options
  • Save leowebguy/e74e790ea4cdd597b37c to your computer and use it in GitHub Desktop.
Save leowebguy/e74e790ea4cdd597b37c to your computer and use it in GitHub Desktop.
Insert data into custom table on WordPress (wpdb)
<?php
global $wpdb;
$value = preg_replace("/\r\n|\r|\n/",'-',$value); //replace breaks by "-"
$sql = "INSERT INTO `".$wpdb->prefix."contacts` (`CONTENT`) values ('" . $value . "|WEBDEV|" . date("m.d.y h.i A") . "')";
$wpdb->query($sql);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment