Home Forums Add-ons Options Page Creating Options Pages from a plugin?


Creating Options Pages from a plugin?

  • Looking for direction…

    I’ve got a simple plugin we use in house that I’m trying to expand a little. The short version is the plugin creates a Custom Content Menu item on the Admin menu and a “Setteings” item on the WP settings menu.

    What I’m trying to do is add a form to the settings page that collects some info from the user and uses that to create an ACF Options Page in the Custom Content section. I have the form, and it ACTS like it’s working. When the form is submitted, the Success message pops up, and the page SEEMS like it shows up in the enumeration of Options pages I have elsewhere on the Settings page (using acf_get_options_pages), but the page never shows up in the Custom Content section, and if you refresh the settings page, it disappears from the list of options pages.

    I must be doing this wrong, but I’m not finding anything specific to my use case when searching. Most of what I’m finding is “put acd_add_options_page in your theme functions.php” which isn’t an option here because it’s a plugin and it needs to be dynamic.

    Any thoughts?

  • The page is not permanent and only appears when the settings are saved and the page is added.

    To do this you must save the information into the database and then you must get this information on ‘init’ and create the other options page on every page load.

    // in functions.php or some other locations that is loaded on every page load
    add_action('acf/init', 'create_options_page');
    function create_options_page() {
      // get values from settings page
      // and register acf_options page
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.