Title: Group Capability IDs by Post Type?
Last modified: August 29, 2022

---

# Group Capability IDs by Post Type?

 *  Resolved [Howdy_McGee](https://wordpress.org/support/users/howdy_mcgee/)
 * (@howdy_mcgee)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/group-capability-ids-by-post-type/)
 * Hello,
 * I’m working on a 3rd party plugin. My understanding of Groups is that it stores
   Capabilities by IDs. Is there a function or static method to get these capabilities
   by Post Type?
 * In my ideal world, a function where you would pass in a post type and get returned
   an array of those post type capabilities indexed by their Groups Capability ID.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Tanue Eugen-Bleck Mbunwo](https://wordpress.org/support/users/eugenbleck/)
 * (@eugenbleck)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/group-capability-ids-by-post-type/#post-15964877)
 * Hi there McGee,
 * Good evening. I trust you are well and safe!
 * Perhaps this could be of help to you:
    [https://github.com/itthinx/groups/blob/ac918b544b0c2ff31eb8fa9290bbdbf36de87cb3/legacy/access/class-groups-post-access-legacy.php](https://github.com/itthinx/groups/blob/ac918b544b0c2ff31eb8fa9290bbdbf36de87cb3/legacy/access/class-groups-post-access-legacy.php)
 * Precisely, `Groups_Post_Access_Legacy::get_read_post_capabilities( $post_id )`.
 * STAY SAFE and be awesome!
    Best, Eugen.
 *  Plugin Author [Kento](https://wordpress.org/support/users/proaktion/)
 * (@proaktion)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/group-capability-ids-by-post-type/#post-15965030)
 * Hi,
 * I would strongly advise **against** using legacy functions such as the one [@eugenbleck](https://wordpress.org/support/users/eugenbleck/)
   mentions. Especially if you are in the process of creating a new 3rd party integration,
   that would be something that you should definitely avoid.
 * [@howdy_mcgee](https://wordpress.org/support/users/howdy_mcgee/) I’d rather point
   you directly to this function [https://github.com/itthinx/groups/blob/master/lib/core/class-groups-capability.php#L206](https://github.com/itthinx/groups/blob/master/lib/core/class-groups-capability.php#L206)
   which allows you to obtain the entry for a named capability, of which you can
   obtain the corresponding capability_id used to identify that within Groups.
 * Illustrative example for the `publish_posts` capability:
 *     ```
       $capability = Groups_Capability::read_by_capability( 'publish_posts' );
       if ( $capability ) {
           $capability_id = $capability->capability_id;
       }
       ```
   
 * Marking as resolved as I would assume that this is what you were looking for,
   but do feel free to ask if you need further help on this.
 * Cheers

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Group Capability IDs by Post Type?’ is closed to new replies.

 * ![](https://ps.w.org/groups/assets/icon-256x256.png?rev=983146)
 * [Groups](https://wordpress.org/plugins/groups/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/groups/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/groups/)
 * [Active Topics](https://wordpress.org/support/plugin/groups/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/groups/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/groups/reviews/)

## Tags

 * [access control](https://wordpress.org/support/topic-tag/access-control/)
 * [capabilities](https://wordpress.org/support/topic-tag/capabilities/)
 * [capability](https://wordpress.org/support/topic-tag/capability/)
 * [group](https://wordpress.org/support/topic-tag/group/)
 * [memberships](https://wordpress.org/support/topic-tag/memberships/)

 * 2 replies
 * 3 participants
 * Last reply from: [Kento](https://wordpress.org/support/users/proaktion/)
 * Last activity: [3 years, 8 months ago](https://wordpress.org/support/topic/group-capability-ids-by-post-type/#post-15965030)
 * Status: resolved