Make WordPress Core

Ticket #58887: 58887.1.diff

File 58887.1.diff, 1.4 KB (added by khokansardar, 3 years ago)

I have updated the patch. Please check.

  • src/wp-includes/admin-bar.php

    diff --git src/wp-includes/admin-bar.php src/wp-includes/admin-bar.php
    index d1d438d9e5..5e1f2b8fb0 100644
    function wp_admin_bar_new_content_menu( $wp_admin_bar ) { 
    940940                $actions['post-new.php?post_type=page'] = array( $cpts['page']->labels->name_admin_bar, 'new-page' );
    941941        }
    942942
    943         unset( $cpts['post'], $cpts['page'], $cpts['attachment'] );
     943        if ( isset( $cpts['wp_block'] ) && true === use_block_editor_for_post_type( $cpts['wp_block']->name ) && current_user_can( $cpts['wp_block']->cap->create_posts ) ) {
     944                $actions['post-new.php?post_type=wp_block'] = array( $cpts['wp_block']->labels->name_admin_bar, 'new-wp_block' );
     945        }
     946
     947        unset( $cpts['post'], $cpts['page'], $cpts['attachment'], $cpts['wp_block'] );
    944948
    945949        // Add any additional custom post types.
    946950        foreach ( $cpts as $cpt ) {
  • src/wp-includes/post.php

    diff --git src/wp-includes/post.php src/wp-includes/post.php
    index 22a37683ea..32ef33cb0b 100644
    function create_initial_post_types() { 
    307307                        '_builtin'              => true, /* internal use only. don't use this when registering your own post type. */
    308308                        'show_ui'               => true,
    309309                        'show_in_menu'          => false,
     310                        'show_in_admin_bar'     => true,
    310311                        'rewrite'               => false,
    311312                        'show_in_rest'          => true,
    312313                        'rest_base'             => 'blocks',