最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

capabilities - Notice: Undefined property: stdClass::$delete_posts with custom post type

matteradmin7PV0评论

I created a custom post type called gdpr_qao and I set 'capability_type' => array( 'gdpr_qao', 'gdpr_qsaos' ) in register_post_type arguments. On main custom post type screen I get:

Notice: Undefined property: stdClass::$delete_posts in /srv/www/wp-plugins/public_html/wp-admin/includes/class-wp-posts-list-table.php on line 411

and in bulk actions there isn't delete option.

How can I solve this problem?

Here the custom post type code:

public function register_gdpr_qao() {

    $labels = array(
        'name'               => _x( 'Problemi & Pareri GDPR', 'post type general name', 'ccwdpo' ),
        'singular_name'      => _x( 'Problema & Parere GDPR', 'post type singular name', 'ccwdpo' ),
        'menu_name'          => _x( 'Problemi & Pareri', 'admin menu', 'ccwdpo' ),
        'name_admin_bar'     => _x( 'Problemi & Pareri GDPR', 'add new on admin bar', 'ccwdpo' ),
        'add_new'            => _x( 'Aggiungi nuovo', 'quesito', 'ccwdpo' ),
        'add_new_item'       => __( 'Nuovo Problema & Parere', 'ccwdpo' ),
        'new_item'           => __( 'Nuovo P&P', 'ccwdpo' ),
        'edit_item'          => __( 'Modifica Problema & Parere', 'ccwdpo' ),
        'view_item'          => __( 'Visualizza P&P', 'ccwdpo' ),
        'all_items'          => __( 'Tutti i Problemi & Pareri', 'ccwdpo' ),
        'search_items'       => __( 'Cerca P&P', 'ccwdpo' ),
        'parent_item_colon'  => __( 'Genitori dei P&P:', 'ccwdpo' ),
        'not_found'          => __( 'Nessun Problema & Parere trovato.', 'ccwdpo' ),
        'not_found_in_trash' => __( 'Nessun Problema & Parere trovato nel Cestino.', 'ccwdpo' )
    );

    $args = array(
        'labels'             => $labels,
        'description'        => __( 'Descrizione.', 'ccwdpo' ),
        'public'             => true,
        'publicly_queryable' => true,
        'show_ui'            => true,
        'show_in_menu'       => true,
        'query_var'          => true,
        'rewrite'            => array( 'slug' => 'gdpr-qao' ),
        'capability_type'    => array( 'gdpr_qao', 'gdpr_qsaos' ),
        //'map_meta_cap'       => true,
        'has_archive'        => true,
        'hierarchical'       => false,
        'menu_position'      => 6,
        //'menu_icon'          => 'data:image/svg+xml;base64,',
        'supports'           => array( 'title', 'editor', 'author' ),
        'taxonomies'         => array( 'gdpr_category', 'gpdr_area_of_interest' )
    );

    register_post_type( 'gdpr_qao', $args );

}
Post a comment

comment list (0)

  1. No comments so far