Closed stilografico closed 1 year ago
Hello,
Thanks for the feedback!
The new acfe/validate_post_type_archive
hook let you customize the entire "Archive" Options Page. This includes the menu title, page title... and of course the capability
. This new hook gives more control to developers as they can now customize anything related to that Options Page.
Here is a usage example:
add_filter('acfe/validate_post_type_archive/name=my-post-type', 'my_validate_post_type_archive');
function my_validate_post_type_archive($args){
/**
* $args = array(
* 'page_title' => 'My Post Type Archive',
* 'menu_title' => 'Archive',
* 'menu_slug' => 'my-post-type-archive',
* 'post_id' => 'my-post-type_archive',
* 'capability' => 'manage_options',
* 'redirect' => false,
* 'parent_slug' => 'edit.php?post_type=my-post-type',
* 'updated_message' => 'My Post Type Archive Saved.',
* )
*/
// change capability
$args['capability'] = 'edit_posts';
// return
return $args;
}
I'll update the documentation regarding this specific hook later today.
Hope it helps!
Have a nice day!
Regards.
Wonderful! That's perfect, thank you!
I was using this code to enable acfe_archive_editor for non administrators
add_filter('acfe/post_type_archive_capability/name=prodotti', 'enable_acfe_archive_to_editor', 10, 2);
function enable_acfe_archive_to_editor($capability) {
return 'edit_posts';
}
post_type_archive_capability is now deprecated so I updated the filter like this
add_filter('acfe/validate_post_type_archive/name=prodotti', 'enable_acfe_archive_to_editor', 10, 2);
function enable_acfe_archive_to_editor($capability) {
return 'edit_posts';
}
but doing so the acfe_archive_editor is disabled even for administrators
What should be the correct syntax?