Opened 10 years ago
Last modified 5 years ago
#31504 new defect (bug)
Add new item gives bunch of errors if disabled
Reported by: | ozzWANTED | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.1 |
Component: | Posts, Post Types | Keywords: | |
Focuses: | ui, administration | Cc: |
Description
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
Change History (3)
Note: See
TracTickets for help on using
tickets.
NOTE: Actual code was is without /* */