bp_activity_get_post_types_tracking_args

Get tracking arguments for all post types.

Description

(array) bp_activity_get_post_types_tracking_args(); 

Returns (array)

List of post types with their tracking arguments.


Usage

  1. if ( !function_exists( 'bp_activity_get_post_types_tracking_args' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-activity/bp-activity-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_activity_get_post_types_tracking_args(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-activity/bp-activity-functions.php  
  1. function bp_activity_get_post_types_tracking_args() { 
  2. // Fetch all public post types. 
  3. $post_types = get_post_types( array( 'public' => true ), 'names' ); 
  4.  
  5. $post_types_tracking_args = array(); 
  6.  
  7. foreach ( $post_types as $post_type ) { 
  8. $track_post_type = bp_activity_get_post_type_tracking_args( $post_type ); 
  9.  
  10. if ( ! empty( $track_post_type ) ) { 
  11. // Set the post type comments tracking args 
  12. if ( ! empty( $track_post_type->comments_tracking->action_id ) ) { 
  13. // Used to check support for comment tracking by activity type (new_post_type_comment) 
  14. $track_post_type->comments_tracking->comments_tracking = true; 
  15.  
  16. // Used to be able to find the post type this activity type is associated to. 
  17. $track_post_type->comments_tracking->post_type = $post_type; 
  18.  
  19. $post_types_tracking_args[ $track_post_type->comments_tracking->action_id ] = $track_post_type->comments_tracking; 
  20.  
  21. // Used to check support for comment tracking by activity type (new_post_type) 
  22. $track_post_type->comments_tracking = true; 
  23.  
  24. $post_types_tracking_args[ $track_post_type->action_id ] = $track_post_type; 
  25.  
  26.  
  27. /** 
  28. * Filters tracking arguments for all post types. 
  29. * @since 2.2.0 
  30. * @param array $post_types_tracking_args Array of post types with 
  31. * their tracking arguments. 
  32. */ 
  33. return apply_filters( 'bp_activity_get_post_types_tracking_args', $post_types_tracking_args );