• Resolved rddigital

    (@rddigital)


    Hi

    i have 3 custom post type. For one of these, i have “delete” link in the edit.php page list, but for the others 2 i do not have delete link and if i try group action, wp tell me that i have not permissions.

    this is code for cpt that works

    if( is_plugin_active( ‘ultimate-member/ultimate-member.php’ ) ) {
    $args[“capability_type”] = ‘boat’;
    $args[“map_meta_cap”] = true;
    $args[“capabilities”] = array(
    ‘read_post’ => ‘read_boat’,
    ‘read_private_posts’ => ‘read_private_boats’,
    ‘edit_post’ => ‘edit_boat’,
    ‘edit_posts’ => ‘edit_boats’,
    ‘edit_others_posts’ => ‘edit_others_boats’,
    ‘edit_published_posts’ => ‘edit_published_boats’,
    ‘edit_private_posts’ => ‘edit_private_boats’,
    ‘delete_post’ => ‘delete_boat’,
    ‘delete_posts’ => ‘delete_boats’,
    ‘delete_others_posts’ => ‘delete_others_boats’,
    ‘delete_published_posts’ => ‘delete_published_boats’,
    ‘delete_private_posts’ => ‘delete_private_boats’,
    ‘publish_posts’ => ‘publish_boats’,
    ‘moderate_comments’ => ‘moderate_boat_comments’,
    );
    }

    register_post_type( ‘boat’, $args);

    if( is_plugin_active( ‘ultimate-member/ultimate-member.php’ ) ) {
    function add_boats_caps() {
    // gets the administrator role
    $admin = get_role( ‘administrator’ );
    $admin->add_cap( ‘read_boat’ );
    $admin->add_cap( ‘read_private_boat’ );
    $admin->add_cap( ‘edit_boat’ );
    $admin->add_cap( ‘edit_boats’ );
    $admin->add_cap( ‘edit_others_boats’ );
    $admin->add_cap( ‘edit_published_boats’ );
    $admin->add_cap( ‘edit_private_boats’ );
    $admin->add_cap( ‘delete_boats’ );
    $admin->add_cap( ‘delete_boat’ );
    $admin->add_cap( ‘delete_others_boats’ );
    $admin->add_cap( ‘delete_published_boat’ );
    $admin->add_cap( ‘delete_boat’ );
    $admin->add_cap( ‘delete_private_boat’ );
    $admin->add_cap( ‘publish_boats’ );
    $admin->add_cap( ‘moderate_boat_comments’ );
    }
    add_action( ‘admin_init’, ‘add_boats_caps’);
    }

    and this one of the others that doesn’t work

    if( is_plugin_active( ‘ultimate-member/ultimate-member.php’ ) ) {
    $args[“capability_type”] = ‘reservation’;
    $args[“map_meta_cap”] = true;
    $args[“capabilities”] = array(
    ‘read_post’ => ‘read_reservation’,
    ‘read_private_posts’ => ‘read_private_reservations’,
    ‘edit_post’ => ‘edit_reservation’,
    ‘edit_posts’ => ‘edit_reservations’,
    ‘edit_others_posts’ => ‘edit_others_reservations’,
    ‘edit_published_posts’ => ‘edit_published_reservations’,
    ‘edit_private_posts’ => ‘edit_private_reservations’,
    ‘delete_post’ => ‘delete_reservation’,
    ‘delete_posts’ => ‘delete_reservations’,
    ‘delete_others_posts’ => ‘delete_others_reservations’,
    ‘delete_published_posts’ => ‘delete_published_reservations’,
    ‘delete_private_posts’ => ‘delete_private_reservations’,
    ‘publish_posts’ => ‘publish_reservations’,
    ‘moderate_comments’ => ‘moderate_reservation_comments’,
    );
    }

    register_post_type( ‘reservation’, $args);

    if( is_plugin_active( ‘ultimate-member/ultimate-member.php’ ) ) {
    function add_reservations_caps() {
    // gets the administrator role
    $admin = get_role( ‘administrator’ );
    $admin->add_cap( ‘read_reservation’ );
    $admin->add_cap( ‘read_private_reservation’ );
    $admin->add_cap( ‘edit_reservation’ );
    $admin->add_cap( ‘edit_reservations’ );
    $admin->add_cap( ‘edit_others_reservations’ );
    $admin->add_cap( ‘edit_published_reservations’ );
    $admin->add_cap( ‘edit_private_reservations’ );
    $admin->add_cap( ‘delete_reservations’ );
    $admin->add_cap( ‘delete_reservation’ );
    $admin->add_cap( ‘delete_others_reservations’ );
    $admin->add_cap( ‘delete_published_reservation’ );
    $admin->add_cap( ‘delete_reservation’ );
    $admin->add_cap( ‘delete_private_reservation’ );
    $admin->add_cap( ‘publish_reservations’ );
    $admin->add_cap( ‘moderate_reservation_comments’ );
    }
    add_action( ‘admin_init’, ‘add_reservations_caps’);
    }

Viewing 1 replies (of 1 total)
  • Thread Starter rddigital

    (@rddigital)

    missing

    $admin->add_cap( ‘delete_published_reservation’ );
    $admin->add_cap( ‘delete_published_reservations’ );

Viewing 1 replies (of 1 total)
  • The topic ‘delete link hidden’ is closed to new replies.