Support Forum » User Profile

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Relationship field ignores "max_clone" setting #45084
    Olivier van HeldenOlivier van Helden
    Participant

    I had the same issue. Max clone is enforced with metabox builder, but not with the code generated by metabox builder. However, I found a fix: 1 must be passed as a numeric value, not a string.

    So I replaced
    `
    'field' => [
    'max_clone' => '1',
    ],
    `

    by
    `
    'field' => [
    'max_clone' => 1,
    ],
    `

    And it works as expected now.

    in reply to: custom post type capabilities #38497
    Olivier van HeldenOlivier van Helden
    Participant

    I was looking for the same info and after digging, I found out that caps added must match capability_type value ('custom' above).

    So if you set 'capability_type' => 'custom', the code should be:

    
    $role->add_cap( 'delete_customs',        true );
    $role->add_cap( 'edit_customs',        true );
    $role->add_cap( 'edit_others_customs',        true );
    $role->add_cap( 'publish_customs',        true );
    $role->add_cap( 'read_private_customs',        true );
    // ...
    

    (note cap type is singular and caps added are plural)

    But if you set `'capability_type' => 'news_post', then you can use:

    
    $role->add_cap( 'delete_news_posts',        true );
    $role->add_cap( 'edit_news_posts',        true );
    $role->add_cap( 'edit_others_news_posts',        true );
    $role->add_cap( 'publish_news_posts',        true );
    $role->add_cap( 'read_private_news_posts',        true );
    
Viewing 2 posts - 1 through 2 (of 2 total)