Custom Fields
Re-Envisioned
Support MB Custom Post Type Faulty 'capability_type' argument

  • Creator
    Topic
  • #26724
    Resolved Antonius CezarHegyes
    Participant

    Hello!

    I've used the UI to register a CPT with WordPress and I set the capability type to 'custom'. According to the documentation (https://docs.metabox.io/extensions/mb-custom-post-type/), that should set the 'capability_type' to array( 'plugin-product', 'plugin-products' ) (since my slug is plugin-product) but it simply sets it to custom instead.

    This is the value of the post_content attribute saved into the database:

    {"slug":"plugin-product","function_name":"your_prefix_register_post_type","text_domain":"your-textdomain","label":"Plugin Products","labels":{"name":"Plugin Products","singular_name":"Plugin Product","add_new":"Add New","add_new_item":"Add new plugin product","edit_item":"Edit Plugin Product","new_item":"New Plugin Product","view_item":"View Plugin Product","view_items":"View Plugin Products","search_items":"Search Plugin Products","not_found":"No plugin products found","not_found_in_trash":"No plugin products found in Trash","parent_item_colon":"Parent Plugin Product:","all_items":"All Plugin Products","archives":"Plugin Product Archives","attributes":"Plugin Product Attributes","insert_into_item":"Insert into plugin product","uploaded_to_this_item":"Uploaded to this plugin product","featured_image":"Featured image","set_featured_image":"Set featured image","remove_featured_image":"Remove featured image","use_featured_image":"Use as featured image","menu_name":"Plugin Products","filter_items_list":"Filter plugin products list","items_list_navigation":"Plugin products list navigation","items_list":"Plugin Products list","item_published":"Plugin Product published","item_published_privately":"Plugin product published privately","item_reverted_to_draft":"Plugin product reverted to draft","item_scheduled":"Plugin Product scheduled","item_updated":"Plugin Product updated"},"description":"","public":true,"hierarchical":false,"exclude_from_search":false,"publicly_queryable":true,"show_ui":true,"show_in_menu":true,"show_in_nav_menus":true,"show_in_admin_bar":true,"show_in_rest":true,"rest_base":"","menu_position":20,"menu_icon":"dashicons-store","capability_type":"custom","supports":["title","editor","thumbnail","revisions"],"taxonomies":[],"has_archive":true,"archive_slug":"","rewrite":{"slug":"","with_front":false},"query_var":true,"can_export":true,"delete_with_user":true}

    I went through the 'PostTypeRegister.php' file in case there was some post-processing taking place before registering the post type with WordPress, but it's being passed on 1-to-1. Because of this, the custom capability feature it broken.

    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #26732
    Long Nguyen
    Moderator

    Hi Antonius,

    Thank you for your feedback.

    We did aware of this issue and the development team is working tirelessly to ship a fix as soon as possible.

    #26744

    Awesome! Thank you, Long!

    #30167
    Andrew Ibarra
    Participant

    has this been fixed?

    #30187
    Long Nguyen
    Moderator

    Hi,

    This issue has been fixed. We've also created a note when creating a new CPT and select Capability Type: Custom

    If select custom capability, make sure to add capabilities to admin or other roles to add or edit posts of this type (using a plugin like Members or User Role Editor).

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.