[wp-trac] [WordPress Trac] #56479: Missing capability shows blank page in WP-Admin

WordPress Trac noreply at wordpress.org
Wed Sep 10 14:54:09 UTC 2025


#56479: Missing capability shows blank page in WP-Admin
-------------------------------+---------------------------------
 Reporter:  vincenz17          |       Owner:  (none)
     Type:  defect (bug)       |      Status:  closed
 Priority:  normal             |   Milestone:
Component:  Posts, Post Types  |     Version:  6.0.2
 Severity:  normal             |  Resolution:  worksforme
 Keywords:                     |     Focuses:  ui, administration
-------------------------------+---------------------------------
Changes (by SirLouen):

 * status:  new => closed
 * resolution:   => worksforme
 * milestone:  Awaiting Review =>


Comment:

 == Reproduction Report
 === Description
 ❌ This report can't validate that the issue can be reproduced.

 === Environment
 - WordPress: 6.9-alpha-60093-src
 - PHP: 8.2.29
 - Server: nginx/1.29.1
 - Database: mysqli (Server: 8.4.6 / Client: mysqlnd 8.2.29)
 - Browser: Chrome 139.0.0.0
 - OS: Windows 10/11
 - Theme: Twenty Twenty-Three 1.6
 - MU Plugins: None activated
 - Plugins:
   * BBB Testing Dolly
   * Test Reports 1.2.0

 === Testing Instructions
 1. Add the code in Supp Artifacts to somewhere it could be executed
 2. Add a user with Author level
 3. Login with that user
 4. Try to create a new post, then edit it
 5. 👌 Both block and classic editor are working as expected, no errors

 === Actual Results
 1. ❌ Error condition not occurring

 === Additional Notes
 - @vincenz17 ideally try to add all the info in your reports in full
 English, not in German
 - I could not reproduce this. I removed one and all the `edit`
 capabilities you set in the CPT and the problem is not happening. Please
 review better your instructions and my code because this is not
 reproducible.
 - Closing for now as `worksforme` feel free to reopen if you can provide
 more reproducible information.
 - Remember that I'm using a 100% clean brand new WP installation.

 === Supplemental Artifacts
 Testing code:

 {{{
 function customPostTypeIBF()
 {
         $labels = array
         (
                 'name'                  => _x('Fortbildungen', 'Post Type
 General Name', 'ibf'),
                 'singular_name'         => _x('Fortbildung', 'Post Type
 Singular Name', 'ibf'),
                 'menu_name'             => __('IBF', 'ibf'),
                 'name_admin_bar'        => __('IBF-Fortbildung', 'ibf'),
                 'archives'              => __('IBF-Archiv', 'ibf'),
                 'all_items'             => __('Alle Fortbildungen',
 'ibf'),
                 'add_new_item'          => __('Neue Fortbildung', 'ibf'),
                 'add_new'               => __('Neue Fortbildung', 'ibf'),
                 'new_item'              => __('Neue Fortbildung', 'ibf'),
                 'edit_item'             => __('Fortbildung bearbeiten',
 'ibf'),
                 'update_item'           => __('Fortbildung speichern',
 'ibf'),
                 'view_item'             => __('Fortbildung anzeigen',
 'ibf'),
                 'view_items'            => __('Fortbildungen anzeigen',
 'ibf'),
                 'search_items'          => __('Fortbildung suchen',
 'ibf'),
         );

         $args = array
         (
                 'label'                 => __('IBF', 'ibf'),
                 'description'           => __('Fortbildungen verwalten',
 'ibf'),
                 'labels'                => $labels,
                 'supports'              => array('title', 'editor',
 'author', 'thumbnail', 'revisions', 'custom-fields'),
                 'show_in_rest'          => true,
                 'hierarchical'          => false,
                 'public'                => true,
                 'show_in_menu'          => true,
                 'menu_position'         => 5,
                 'menu_icon'             => 'dashicons-welcome-learn-more',
                 'has_archive'           => true,
                 'rewrite'               => array('slug' => 'ibf'),
                 'capability_type'       => 'post',
                 'capabilities'          => array
                 (
                        'edit_post'             => 'edit_ibf',
                        'edit_posts'            => 'edit_ibfs',
                        'edit_others_posts'     => 'edit_others_ibf',
                        'publish_posts'         => 'publish_ibf',
                        'read_post'             => 'read_ibf',
                        'read_private_posts'    => 'read_private_ibf',
                        'delete_post'           => 'delete_ibf',
                        'create_posts'          => 'create_ibfs',
                 ),
         );

         register_post_type('ibf', $args);
 }
 add_action('init', 'customPostTypeIBF');

 function ibf_add_caps()
 {
         $role = get_role('author');
         if ( $role ) {
                 $caps = array(
                         'read_ibf',
                         'delete_ibf',
                         'edit_others_ibf',
                         'publish_ibf',
                         'read_private_ibf',
             'create_ibfs',
                 );

                 foreach ( $caps as $cap ) {
                         $role->add_cap( $cap );
                 }
         }
 }
 add_action( 'admin_init', 'ibf_add_caps' );
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56479#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list