Title: Checkbox Problem
Last modified: October 15, 2022

---

# Checkbox Problem

 *  [Aris](https://wordpress.org/support/users/bugsysop/)
 * (@bugsysop)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/checkbox-problem-10/)
 * Hello,
 * I managed to have a working Admin Page with a checkbox (result is correcty stored
   in database) but I can’t figure how to execute some piece of code only if is 
   checked… Found nothing related to checkbox in tutorials.
 * Tried this with no succes:
 *     ```
        if (AdminPageFramework::getOption( 'MyPluginName', 'my_checkbox_2', '1' )) {
           remove_action( 'wp_head', 'feed_links', 2 );
           remove_action( 'wp_head', 'feed_links_extra', 3 );
         } else {}
       ```
   
 * In fact, the code is always executed. Not only when the option is checked…
 * Somebody has an idea?
 * Here is a gist with my full plugin code
    [https://gist.github.com/bugsysop/5b81d62ae49415df4e9c3cc657964118](https://gist.github.com/bugsysop/5b81d62ae49415df4e9c3cc657964118)
    -  This topic was modified 3 years, 7 months ago by [Aris](https://wordpress.org/support/users/bugsysop/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [miunosoft](https://wordpress.org/support/users/miunosoft/)
 * (@miunosoft)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/checkbox-problem-10/#post-16103077)
 * Hi,
 * Try
 *     ```
       $value = AdminPageFramework::getOption( 'MyPluginName', array( 'my_second_section', 'my_checkbox_3' ) );
       ```
   
 * To retrieve a value in a nested array of a multidimensional array, you want to
   pass an array representing the dimensional key path to the second parameter.
 * For example, to get the value `THIS` in the below array,
 *     ```
       array(
           'a' => array( 
               'b' => array(
                   'c' => 'THIS'
               ) 
           )
       )
       ```
   
 * You need to pass `array( 'a', 'b', 'c' )`.
 * You can use `AdminPageFramework_Debug::log()` to check the structure of your 
   options array. The log file will be created in the `wp-content` directory. You
   need to enable `WP_Debug` to use it.
 *     ```
       AdminPageFramework_Debug::log( AdminPageFramework::getOption( 'MyPluginName' ) );
       ```
   
 *  Thread Starter [Aris](https://wordpress.org/support/users/bugsysop/)
 * (@bugsysop)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/checkbox-problem-10/#post-16103385)
 * Thanks a lot, I will try this.
    Have a nice day

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Checkbox Problem’ is closed to new replies.

 * ![](https://ps.w.org/admin-page-framework/assets/icon-256x256.png?rev=998199)
 * [Admin Page Framework](https://wordpress.org/plugins/admin-page-framework/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/admin-page-framework/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/admin-page-framework/)
 * [Active Topics](https://wordpress.org/support/plugin/admin-page-framework/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/admin-page-framework/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/admin-page-framework/reviews/)

## Tags

 * [arrays](https://wordpress.org/support/topic-tag/arrays/)
 * [settings](https://wordpress.org/support/topic-tag/settings/)

 * 2 replies
 * 2 participants
 * Last reply from: [Aris](https://wordpress.org/support/users/bugsysop/)
 * Last activity: [3 years, 7 months ago](https://wordpress.org/support/topic/checkbox-problem-10/#post-16103385)
 * Status: not resolved