0

I am building a plugin and I have made a single setting page that is working without any issue. Since it is becoming very long, and that it is made of 3 distinct sections, I wanted to split it in 3 subpages.

So far I managed to have the 3 pages, and to load the fields in their right page. there are some thing that I can't fix and I can't find an answer for on the codex.

I have a main page and 3 subpages, but currently the main link has it's own empty page. I would like that the clck on the main page goes to the first of the subpages, like the default behaviour of wordpress menu.

I have made 3 different settings_fields for the 3 submenu, but now when I save one, the other two sections are wiped. I want that each field keep his values unless is being changed.

  • Please post all of the code necessary to reproduce the issue. As posted, there is not enough information to solve this problem. – Dave Romsey Sep 21 '16 at 4:37
1

WordPress always saves all options in one group at the same time. So if you have a page with only a part of the options in the group, the rest will be saved as 'unset'.

There are two possible paths to a solution. The easy one is to include all options in every page and use css to hide some of them. They will then be saved unchanged. The other one is splitting the option group into three groups.

Considering the menus: if you set the first page as both the main menu entry and the first submenu entry, you're done.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.