I currently have a custom post type with a sub menu page via add_submenu_page
. On this page I have a form with some basic settings such as a text editor and some radio buttons.
function programme_enable_pages() {
add_submenu_page(
'edit.php?post_type=programmes',
'content',
'Archive content',
'edit_pages',
basename(__FILE__),
'archiveContent'
);
}
add_action( 'admin_menu', 'programme_enable_pages' );
function register_programme_settings() {
register_setting( 'programme_content', 'programme_content' );
register_setting( 'programme_content', 'programme_branding' );
}
add_action( 'admin_init', 'register_programme_settings' );
function archiveContent() { ?>
<div class="wrap">
<form method="post" action="options.php">
<?php
settings_fields( 'programme_content' );
do_settings_sections( 'programme_content' );
wp_editor(
get_option( 'programme_content' ),
'programme_content',
$settings = array(
'textarea_name' => 'programme_content'
)
); ?>
<label><b>Branding options</b></label><br>
<input type="radio" name="programme_branding" id="branding_blue" value="blueBranding" <?php checked('blueBranding', get_option('programme_branding'), true); ?> checked="checked">Blue Branding<br>
<input type="radio" name="programme_branding" id="branding_red" value="redBranding" <?php checked('redBranding', get_option('programme_branding'), true); ?>/>Red Branding<br>
<input type="radio" name="programme_branding" id="branding_orange" value="orangeBranding" <?php checked('orangeBranding', get_option('programme_branding'), true); ?>/>Orange Branding
<?php submit_button(); ?>
</form>
</div>
<?php }
When a user with a role of administrator edits any of the content and saves the changes, the content saves with no issues. But when a user with a role of editor saves the changes, they are directed to a page which states:
Sorry, you are not allowed to manage these options.
Can anyone please point me in the right direction on how I can make anyone with a user role of editor save these options?