Skip to content
On this page

Options Page

The recommended way of doing this currently is to use the registry pattern with acf_add_options_page(), and hook onto init.

php
<?php
// app/Registries/OptionsPageRegistry.php
declare(strict_types=1);

namespace YourNameSpace\YourApp\Registry;

use Forme\Framework\Registry\RegistryInterface;

final class OptionsPageRegistry implements RegistryInterface
{
    public function register(): void
    {
        acf_add_options_page([
            'page_title' => __('Foo Options'),
            'menu_title' => __('Foo Options'),
            'menu_slug'  => 'foo-options',
            'capability' => 'edit_posts',
            'redirect'   => false,
        ]);
    }
}

Code Generation

You can use the codegen cli to scaffold this out e.g.

bash
forme make registry OptionsPage

Made by Moussa Clarke @ Sanders Web Works with ❤️