Error with capabilities on CPT
-
I added a new post type within a pluign, and i receive always this error while adding the featured image to the CPT post:
Notice: Trying to get property of non-object in \mywebsite\wp-includes\capabilities.php</b> on line 1116
Notice: Trying to get property of non-object in \mywebsite\wp-includes\capabilities.php</b> on line 1117
Notice: Trying to get property of non-object in \mywebsite\wp-includes\capabilities.php</b> on line 1117
Notice: Trying to get property of non-object in \mywebsite\wp-includes\capabilities.php</b> on line 1120
Notice: Trying to get property of non-object in \mywebsite\wp-includes\capabilities.php</b> on line 1120I repaired the database, disabled all other plugins, and enabled twentytwelve.
Nothing fixed.
I read that it is an error in registering the post type, this is my actual code:
public function __construct() { //Register the Testimonials post type add_action( 'init', array( $this, 'register_testimonials' ) ); add_action( 'init', array( $this, 'register_tag_tax' ) ); //Enable and define metaboxes for the portfolios add_filter( 'cmb_meta_boxes', array( $this, 'add_meta_boxes' ) ); add_action( 'admin_init', array( $this, 'load_meta_boxes_class' ) ); } /** * Register testimonials post type. * @return void */ public function register_testimonials() { $labels = array( 'name' => __( 'Testimonials', ES_TESTIMONIALS_SLUG ), 'singular_name' => __( 'Testimonial', ES_TESTIMONIALS_SLUG ), 'menu_name' => __( 'Testimonials', ES_TESTIMONIALS_SLUG ), 'all_items' => __( 'All Testimonials', ES_TESTIMONIALS_SLUG ), 'add_new' => __( 'Add New', ES_TESTIMONIALS_SLUG ), 'add_new_item' => __( 'Add New Testimonial', ES_TESTIMONIALS_SLUG ), 'edit_item' => __( 'Edit Testimonial', ES_TESTIMONIALS_SLUG ), 'new_item' => __( 'New Testimonial', ES_TESTIMONIALS_SLUG ), 'view_item' => __( 'View Testimonial', ES_TESTIMONIALS_SLUG ), 'search_items' => __( 'Search Testimonials', ES_TESTIMONIALS_SLUG ), 'not_found' => __( 'No testimonials found', ES_TESTIMONIALS_SLUG ), 'not_found_in_trash' => __( 'No testimonials found in trash', ES_TESTIMONIALS_SLUG ) ); $args = array( 'labels' => $labels, 'description' => __( 'Here you can create testimonials for your website.', ES_TESTIMONIALS_SLUG ), 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'menu_position' => 48, 'menu_icon' => 'dashicons-groups', 'capability_type' => apply_filters( 'es_testimonials_capability_type', 'page' ), 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail' ), 'rewrite' => array( 'slug' => apply_filters( 'es_testimonials_rewrite', 'testimonial' ) ) ); register_post_type( 'testimonial', $args ); }
Do you have any idea about what is the problem?
- The topic ‘Error with capabilities on CPT’ is closed to new replies.