• The plugin can search posts and add the new hashtags perfectly.

    If theres a matching tag in the comments of a post then that because a clickable hashtag search aswell.

    If there is another tagged word in a comment, which hasnt already been entered in a post, then it does not get recognised or added as a hashtag.

    if ( $parent_id = wp_is_post_revision( $post_id ) )
    			$post_id = $parent_id;
    
    			$thepost = get_post($post_id);
    			$content = $thepost->post_content;
    
    			if ( preg_match_all('/#([\p{L}\p{Mn}]+)/u',$content,$matches) ) {
            			foreach( $matches[1] as $hashtag ) {
            				$hash_array[] = str_replace("#", "", $hashtag);
    				}
    				$hash_string = implode(", ", $hash_array);
    				wp_set_post_terms( $post_id, $hash_string, 'hashtags' );
            		}
    	}

    what could I do to modify this so that it will search comments? is it even possible?

    https://wordpress.org/plugins/artifakt-hashtags/

  • The topic ‘How could I go about modifying the code to search comments for tags?’ is closed to new replies.