• Resolved hamid

    (@hmmodern)


    hi everybody

    i one question
    how add checkbox in panel admin wordpress section menu
    Of course i add checkbox in menu panel wordpress but lost checked in refresh page

    <?php if($depth === 0){
    echo "<input type='checkbox' name='$item_id' value='$item_id'";
    if(isset($_POST[$item_id])) echo " checked='checked'";
    echo "/>two col";
    }  ?>
    • This topic was modified 5 years ago by hamid.
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You need to save the box status somewhere when the menu is saved. Then retrieve it from that location to decide if the box should be checked or not. Use the ‘wp_update_nav_menu’ action to trigger your save the status code. You cannot rely upon the value from $_POST because reloads cause a GET request. $_GET will not help either because no query string is passed in the reload URL.

Viewing 1 replies (of 1 total)
  • The topic ‘how get checked or unchecked in page class-walker-nav-menu-edit.php’ is closed to new replies.