Title: default column value during insert
Last modified: August 5, 2020

---

# default column value during insert

 *  Resolved [bb23hk](https://wordpress.org/support/users/bb23hk/)
 * (@bb23hk)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/default-column-value-during-insert/)
 * Hi, I have a table with a field that contains post id (of a custom post type).
   My question is when I insert a new record, I would like to read-only this field
   and give a default value.
 * Currently, I am pasting the post id via ?post_id=999 on the URL. To insert the
   shortcode, I use:-
 * <?php
    if (isset($_GET[‘post_id’])) { $thepost_id = $_GET[‘post_id’]; $thispost
   = get_post( $thepost_id, OBJECT ); echo ‘<p>Editing ‘ . $thispost->post_title.‘
   </p>’; echo ‘[wpdatatable id=3 var1=’ . $thepost_id . ‘]’; echo ‘<div id=”thispostid”
   style=”display: none;”>’ . $thepost_id . ‘</div>’; } else { echo ‘<p>No Class
   Data</p>’; }
 * echo <<<EOT
    <script>document.write(‘[Click me to go Back](https://wordpress.org/support/topic/default-column-value-during-insert/&apos; + document.referrer +&apos;?output_format=md)‘);
   </script> EOT;
 * And I use “where classname= %VAL1%” in SQL. Any ideas?

Viewing 1 replies (of 1 total)

 *  Plugin Author [wpDataTables](https://wordpress.org/support/users/wpdatatables/)
 * (@wpdatatables)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/default-column-value-during-insert/#post-13216414)
 * Hello there
 * Creating tables using SQL queries is not included in the Lite version of the 
   plugin, so it seems you have the full version installed.
 * Due to rules of wordpress.org, we cannot provide support for the full version
   of the plugin on this forum.
 * Please access our official support platform and open a new ticket, and one of
   our support managers will gladly help. You can access the platform from our official
   website.
 * Kind regards.

Viewing 1 replies (of 1 total)

The topic ‘default column value during insert’ is closed to new replies.

 * ![](https://ps.w.org/wpdatatables/assets/icon-128x128.gif?rev=3010404)
 * [wpDataTables - WordPress Data Table, Dynamic Tables & Table Charts Plugin](https://wordpress.org/plugins/wpdatatables/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpdatatables/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpdatatables/)
 * [Active Topics](https://wordpress.org/support/plugin/wpdatatables/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpdatatables/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpdatatables/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [wpDataTables](https://wordpress.org/support/users/wpdatatables/)
 * Last activity: [5 years, 9 months ago](https://wordpress.org/support/topic/default-column-value-during-insert/#post-13216414)
 * Status: resolved