diff --git a/includes/class-feed.php b/includes/class-feed.php index 538687ad..63562e27 100644 --- a/includes/class-feed.php +++ b/includes/class-feed.php @@ -61,7 +61,7 @@ private function register_hooks() { add_filter( 'pre_option_rss_use_excerpt', array( $this, 'feed_use_excerpt' ), 90 ); add_filter( 'friends_early_modify_feed_item', array( $this, 'apply_early_feed_rules' ), 10, 3 ); add_filter( 'friends_modify_feed_item', array( $this, 'apply_feed_rules' ), 10, 3 ); - add_filter( 'friends_modify_feed_item', array( $this, 'extract_tags' ), 10, 3 ); + add_filter( 'friends_modify_feed_item', array( $this, 'extract_tags' ) ); add_action( 'rss_item', array( $this, 'feed_additional_fields' ) ); add_action( 'rss2_item', array( $this, 'feed_additional_fields' ) ); @@ -442,11 +442,16 @@ public function validate_feed_catch_all( $catch_all ) { return $catch_all; } - public function extract_tags( $item, User_Feed $feed = null, User $friend_user = null ) { - // This is a variation of the ACTIVITYPUB_HASHTAGS_REGEXP. - if ( \preg_match_all( '/(?:(?<=\s)|(?<=

)|(?<=
)|^)#(\w+)(?:(?=\s|[[:punct:]]|$))/ui', \wp_strip_all_tags( $item->post_content ), $match ) ) { + public function extract_tags( $item ) { + // (?post_content ), $match ) ) { $tags = \implode( ', ', $match[1] ); - $item->tags = $tags; + if ( is_array( $item->tags ) ) { + $item->tags = array_merge( $item->tags, $tags ); + } else { + $item->tags = $tags; + } } return $item; @@ -633,6 +638,7 @@ public function process_incoming_feed_items( array $items, User_Feed $user_feed $modified_posts[] = $post_id; } } + wp_set_post_tags( $post_id, $item->tags ); } else { $post_data['post_type'] = Friends::CPT; $post_data['post_date_gmt'] = $item->date;