[wp-trac] [WordPress Trac] #31504: Add new item gives bunch of errors if disabled

WordPress Trac noreply at wordpress.org
Mon Mar 2 14:00:02 UTC 2015


#31504: Add new item gives bunch of errors if disabled
--------------------------------+-----------------------------
 Reporter:  ozzWANTED           |      Owner:
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Menus               |    Version:  4.1
 Severity:  normal              |   Keywords:
  Focuses:  ui, administration  |
--------------------------------+-----------------------------
 I created new post category 'cars'. But cars are added/deleted via Php
 code automatically via:
 wp_insert_post(...)
 and
 wp_delete_post(...)

 So I wanted to remove 'add new car' from navigation menu. And somehow
 remove the 'delete' capability.

 So I used this code in plugins register_post_type $args:


 {{{
 array(
 ...
                 'capability_type'     => 'car',
                 /*'capabilities' => array(
                         'create_posts' => false, // Removes support for
 the "Add New" function - DOESN'T WORK
                         'delete_post' => false,
                         'publish_posts' => false,
                 ),
                 'map_meta_cap' => true, // Set to false, if users are not
 allowed to edit/delete existing posts
                 */
 ...)
 }}}

 Appears the 'add_new' is not shown, but now I got bunch of warnings all
 over the admin:


 {{{
 Notice: Undefined offset: 0 in C:\Program Files
 (x86)\Zend\Apache2\htdocs\GitHub\*WEB-NAME*\wp-includes\capabilities.php
 on line 1075
 Notice: Trying to get property of non-object in C:\Program Files
 (x86)\Zend\Apache2\htdocs\GitHub\*WEB-NAME*\wp-includes\capabilities.php
 on line 1077
 Notice: Trying to get property of non-object in C:\Program Files
 (x86)\Zend\Apache2\htdocs\GitHub\*WEB-NAME*\wp-includes\capabilities.php
 on line 1081
 Notice: Trying to get property of non-object in C:\Program Files
 (x86)\Zend\Apache2\htdocs\GitHub\*WEB-NAME*\wp-includes\capabilities.php
 on line 1083
 Notice: Trying to get property of non-object in C:\Program Files
 (x86)\Zend\Apache2\htdocs\GitHub\*WEB-NAME*\wp-includes\capabilities.php
 on line 1084
 Notice: Trying to get property of non-object in C:\Program Files
 (x86)\Zend\Apache2\htdocs\GitHub\*WEB-NAME*\wp-includes\capabilities.php
 on line 1084
 Notice: Trying to get property of non-object in C:\Program Files
 (x86)\Zend\Apache2\htdocs\GitHub\*WEB-NAME*\wp-includes\capabilities.php
 on line 1087
 Notice: Trying to get property of non-object in C:\Program Files
 (x86)\Zend\Apache2\htdocs\GitHub\*WEB-NAME*\wp-includes\capabilities.php
 on line 1087

 Notice: Undefined offset: 0 in C:\Program Files
 (x86)\Zend\Apache2\htdocs\GitHub\*WEB-NAME*\wp-includes\capabilities.php
 on line 1075
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31504>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list