• Resolved Rituparna Sonowal

    (@icraftzone)


    I have added custom setting options page under WordPress settings and those are working perfectly. I have tested their values also. But when I am using those values inside function file within add_action init hook to perform something on form submission, those values are returning as null. Everything is working except those values return as null. A few examples will really help me! Thanks in advance ??

    `add_action(‘init’, ‘myFunc’);
    function myFunc(){
    $myoptions = get_option( ‘custom_option’ );
    $trueorfalse = $myoptions[‘my_swicth’];
    $alertemail = $myoptions[‘alert_email’]; // both working outside
    if( 1 == $trueorfalse && ‘[email protected]’ == $alertemail ){
    //do something
    }
    }`

  • The topic ‘Issue in using custom settings option values in add_action init hook’ is closed to new replies.