bp_activity_get_post_types_tracking_args()
Get tracking arguments for all post types.
Description
Return
(array) List of post types with their tracking arguments.
Source
File: bp-activity/bp-activity-functions.php
function bp_activity_get_post_types_tracking_args() { // Fetch all public post types. $post_types = get_post_types( array( 'public' => true ), 'names' ); $post_types_tracking_args = array(); foreach ( $post_types as $post_type ) { $track_post_type = bp_activity_get_post_type_tracking_args( $post_type ); if ( ! empty( $track_post_type ) ) { // Set the post type comments tracking args if ( ! empty( $track_post_type->comments_tracking->action_id ) ) { // Used to check support for comment tracking by activity type (new_post_type_comment) $track_post_type->comments_tracking->comments_tracking = true; // Used to be able to find the post type this activity type is associated to. $track_post_type->comments_tracking->post_type = $post_type; $post_types_tracking_args[ $track_post_type->comments_tracking->action_id ] = $track_post_type->comments_tracking; // Used to check support for comment tracking by activity type (new_post_type) $track_post_type->comments_tracking = true; } $post_types_tracking_args[ $track_post_type->action_id ] = $track_post_type; } } /** * Filters tracking arguments for all post types. * * @since BuddyPress 2.2.0 * * @param array $post_types_tracking_args Array of post types with * their tracking arguments. */ return apply_filters( 'bp_activity_get_post_types_tracking_args', $post_types_tracking_args ); }
Changelog
Version | Description |
---|---|
BuddyPress 2.5.0 Include post type comments tracking args if needed | BuddyPress 2.5.0 Include post type comments tracking args if needed |
BuddyPress 2.2.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.