WordPress.org

Make WordPress Core

Ticket #23031: 23031.diff

File 23031.diff, 4.3 KB (added by dannydehaan, 5 years ago)

23031

  • wp-admin/includes/plugin.php

    diff --git wp-admin/includes/plugin.php wp-admin/includes/plugin.php
    index f305ef9..481e0b6 100644
    function get_admin_page_parent( $parent = '' ) { 
    14131413                foreach ( $submenu[$parent] as $submenu_array ) {
    14141414                        if ( isset( $_wp_real_parent_file[$parent] ) )
    14151415                                $parent = $_wp_real_parent_file[$parent];
    1416                         if ( !empty($typenow) && ($submenu_array[2] == "$pagenow?post_type=$typenow") ) {
     1416                        if ( !empty($typenow) && ( isset( $submenu_array[2] ) && $submenu_array[2] == "$pagenow?post_type=$typenow") ) {
    14171417                                $parent_file = $parent;
    14181418                                return $parent;
    1419                         } elseif ( $submenu_array[2] == $pagenow && empty($typenow) && ( empty($parent_file) || false === strpos($parent_file, '?') ) ) {
     1419                        } elseif ( isset( $submenu_array[2] ) && $submenu_array[2] == $pagenow && empty($typenow) && ( empty($parent_file) || false === strpos($parent_file, '?') ) ) {
    14201420                                $parent_file = $parent;
    14211421                                return $parent;
    14221422                        } else
  • wp-admin/index.php

    diff --git wp-admin/index.php wp-admin/index.php
    index dd429e7..3c7270d 100644
    if ( current_user_can( 'moderate_comments' ) ) 
    7676        $help .= '<p>' . __('<strong>Recent Comments</strong> - Shows the most recent comments on your posts (configurable, up to 30) and allows you to moderate them.') . '</p>';
    7777if ( current_user_can( 'publish_posts' ) )
    7878        $help .= '<p>' . __('<strong>Incoming Links</strong> - Shows links to your site found by Google Blog Search.') . '</p>';
    79 if ( current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
    80         $help .= '<p>' . __('<strong>QuickPress</strong> - Allows you to create a new post and either publish it or save it as a draft.') . '</p>';
    81         $help .= '<p>' . __('<strong>Recent Drafts</strong> - Displays links to the 5 most recent draft posts you&#8217;ve started.') . '</p>';
     79if( post_type_exists( 'post ' ) ) {
     80        if ( current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
     81                $help .= '<p>' . __('<strong>QuickPress</strong> - Allows you to create a new post and either publish it or save it as a draft.') . '</p>';
     82                $help .= '<p>' . __('<strong>Recent Drafts</strong> - Displays links to the 5 most recent draft posts you&#8217;ve started.') . '</p>';
     83        }
    8284}
    8385$help .= '<p>' . __('<strong>WordPress Blog</strong> - Latest news from the official WordPress project.') . '</p>';
    8486$help .= '<p>' . __('<strong>Other WordPress News</strong> - Shows the <a href="http://planet.wordpress.org" target="_blank">WordPress Planet</a> feed. You can configure it to show a different feed of your choosing.') . '</p>';
  • wp-admin/menu.php

    diff --git wp-admin/menu.php wp-admin/menu.php
    index 90c585d..fa7aa87 100644
    $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' ); 
    4949$menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'none' );
    5050        $submenu['edit.php'][5]  = array( __('All Posts'), 'edit_posts', 'edit.php' );
    5151        /* translators: add new post */
    52         $submenu['edit.php'][10]  = array( _x('Add New', 'post'), get_post_type_object( 'post' )->cap->create_posts, 'post-new.php' );
     52       
     53        if( post_type_exists( 'post' ) ) {
     54                $submenu['edit.php'][10]  = array( _x('Add New', 'post'), get_post_type_object( 'post' )->cap->create_posts, 'post-new.php' );
     55        }
    5356
    5457        $i = 15;
    5558        foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
  • wp-includes/admin-bar.php

    diff --git wp-includes/admin-bar.php wp-includes/admin-bar.php
    index 6af1021..87bfdb0 100644
    function wp_admin_bar_my_sites_menu( $wp_admin_bar ) { 
    362362                        'title'  => __( 'Dashboard' ),
    363363                        'href'   => admin_url(),
    364364                ) );
    365 
    366                 if ( current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
    367                         $wp_admin_bar->add_menu( array(
    368                                 'parent' => $menu_id,
    369                                 'id'     => $menu_id . '-n',
    370                                 'title'  => __( 'New Post' ),
    371                                 'href'   => admin_url( 'post-new.php' ),
    372                         ) );
     365               
     366                if( post_type_exists( 'post' ) ) {
     367                        if ( current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
     368                                $wp_admin_bar->add_menu( array(
     369                                        'parent' => $menu_id,
     370                                        'id'     => $menu_id . '-n',
     371                                        'title'  => __( 'New Post' ),
     372                                        'href'   => admin_url( 'post-new.php' ),
     373                                ) );
     374                        }
    373375                }
    374376
    375377                if ( current_user_can( 'edit_posts' ) ) {