TransWikia.com

can we store custom option field in custom data base table

WordPress Development Asked on January 22, 2021

Hi i just want to know can we store the value of a custom created option in my custom database table? If yes then how?

do I need to edit register_setting()

Here is my code i want to save this in table named wp_ldc_user please help me with this

register_setting(
    'ldc_settings', 
    'ldc_username',
    'sanitize_text_field'
);

add_settings_field(
    'ldc_username',
    'Username',
     array($this,'ldc_text_field_html'), 
    'ldc_quize', 
    'ldc_settings_section', 
    array( 
        'label_for' => 'ldc_username', 
    )
);

function ldc_text_field_html(){
 
   $text = get_option( 'ldc_username' );
 
   printf(
       '<input type="text" id="ldc_username" name="ldc_username" value="%s" />',
       esc_attr( $text )
    );
 
 }

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP