diff --git src/bp-activity/bp-activity-functions.php src/bp-activity/bp-activity-functions.php
index b5e8a93..49f193e 100644
|
|
function bp_activity_get_post_type_tracking_args( $post_type ) { |
517 | 517 | * @return array List of post types with their tracking arguments. |
518 | 518 | */ |
519 | 519 | function bp_activity_get_post_types_tracking_args() { |
520 | | // Fetch all public post types. |
521 | | $post_types = get_post_types( array( 'public' => true ), 'names' ); |
| 520 | static $args; |
522 | 521 | |
523 | | $post_types_tracking_args = array(); |
| 522 | if ( ! isset( $args ) ) { |
| 523 | // Fetch all public post types. |
| 524 | $post_types = get_post_types( array( 'public' => true ), 'names' ); |
524 | 525 | |
525 | | foreach ( $post_types as $post_type ) { |
526 | | $track_post_type = bp_activity_get_post_type_tracking_args( $post_type ); |
| 526 | $post_types_tracking_args = array(); |
| 527 | |
| 528 | foreach ( $post_types as $post_type ) { |
| 529 | $track_post_type = bp_activity_get_post_type_tracking_args( $post_type ); |
| 530 | |
| 531 | if ( ! empty( $track_post_type ) ) { |
| 532 | $post_types_tracking_args[ $track_post_type->action_id ] = $track_post_type; |
| 533 | } |
527 | 534 | |
528 | | if ( ! empty( $track_post_type ) ) { |
529 | | $post_types_tracking_args[ $track_post_type->action_id ] = $track_post_type; |
530 | 535 | } |
531 | 536 | |
| 537 | /** |
| 538 | * Filters tracking arguments for all post types. |
| 539 | * |
| 540 | * @since 2.2.0 |
| 541 | * |
| 542 | * @param array $post_types_tracking_args Array of post types with |
| 543 | * their tracking arguments. |
| 544 | */ |
| 545 | $args = apply_filters( 'bp_activity_get_post_types_tracking_args', $post_types_tracking_args ); |
532 | 546 | } |
533 | 547 | |
534 | | /** |
535 | | * Filters tracking arguments for all post types. |
536 | | * |
537 | | * @since 2.2.0 |
538 | | * |
539 | | * @param array $post_types_tracking_args Array of post types with |
540 | | * their tracking arguments. |
541 | | */ |
542 | | return apply_filters( 'bp_activity_get_post_types_tracking_args', $post_types_tracking_args ); |
| 548 | return $args; |
543 | 549 | } |
544 | 550 | |
545 | 551 | /** |