In your regex there is a space before the # $mh_regex = "/\ #[a-zA-Z0-9-]+/"; so it would match # tag instead of #tag.
It might be a good idea to test your regex using this online tool: http://www.regexr.com/ it’s really usefull for testing
Related Posts:
- Edit tag cloud widget number
- How to automatically apply woocommerce product title to all product images alt tags?
- Display user’s total comment count outside The Loop
- Facebook Comment Count
- Getting the comment number relative to all the post’s comments
- How to output a permanently delete comment link?
- count number of user comments with a specific comment meta value
- tag search using WP_Query
- Change comments form title on a page by page basis
- show limited tags in an article
- How do I make wordpress comment fields required?
- display most popular tags in two columns
- How to add a post or page tag to the list of classes appearing in the body tag’s class attribute?
- Displaying Only Certain Tags in Loop
- query if on page/2/?
- Notify WordPress Site I Have Linked To Them
- Replace comment avatars and links at the same time
- Automatically generate Post/Page from searched Database item?
- Adding ads code between comments
- Add relevant tag to search results
- Must Use Plugin Causing Query Error
- comments_number display outside specified span
- How to create a linked tag list in my sidebar
- Trying to implement Ajax comments in WordPress, getting WP error
- How does this WordPress Plugin (Thrive Comments) apply their custom comment sort? [closed]
- Adding country tags automatically
- Way to querry data (tags) from a wordpress database?
- “comments.php” not available after edit in WP administration
- User’s total comment count excluding comments on their own posts
- Sending data from custom inputs in WordPress comment form in the admin notification email
- Why does my callback function not work with this custom filter hook?
- Customize Theme comment template to Insert VoteUp and VoteDown buttons
- How to implement a rating and review system for WordPress custom posts?
- Ajax load more button for comments wordpress
- Limit 1 global comment per minute
- Create Page To Count Comments For Each Post In WordPress Site
- Adding Taxonomy Image to taxonomy loop [closed]
- comments sorting incorrectly across multiple pages
- Commenting out unwated CSS/scripts in HTML with PHP
- wp-comments-post.php file returns a blank page
- php function to display commenter username or login
- If tag equals then show else show
- Way to bulk make all my tags lowercase?
- Adding Meta Tags to a Post using its Tags, Excerpt and content
- List posts that don’t have a specific tag?
- Get post id within comments loop
- Need to put a script above tag in header.php – WP 5.7.1
- WordPress comment submit button substitutes/options
- Use Tags to initiate Search
- How to list commenters and days since last commented
- Trying to prepend a Hashtag symbol to the_tags links [closed]
- Appended comments but they show up above the content instead of below
- stripping tags from excerpt in WordPress is not working
- get comment data using comment id
- Removing the comment function within wordpress
- Fetching Initials of the Commentator in the WordPress Website
- get_comments_number() returns 0
- How can I include the user id inside of a shortcode php output?
- Querying for specific tags
- Limit tags shown in post
- Conditionally load class in the comment section of the post page
- How to get comment_ID by post_ID in wordpress
- Comment_author_url doing nothing
- Fatal error: Cannot redeclare comment_theme()
- remove specificly the last tag in all posts
- comment_post (if comment is approved OR $comment_approved === 1) not working?
- Tag title not being returned in page title of tag archives
- Show all people who commented on all posts by an author
- How to pass parameters in wordpress shortcode?
- How to add Text before my Custom Term and hide it when empty
- Commenting requires wordpress login, wordpress discussion and post comments tick boxes are checked
- Comments on my custom post type
- Fetch commens from a specific post
- How do I create a WP endpoint that retrieves all custom post types that have a tag?
- Real time notification on user profile after new comment
- Display tag links on archive page?
- Using Tag Groups: Displaying groups and adjacent tags of current post
- How can I output the slug of a comment author?
- Show content by using tags
- How to associate dynamic PHP page for chosen WordPress tag?
- Get a list of tags present in a paged front page
- Add Alt attribute to image served with php
- Notify admin (by email) if post added with specific tag
- Getting most popular posts based on Facebook comments count
- Using tag to output text in Genesis?
- Is there a way to randomize and connect a background and header image?
- WordPress – show number of comments for each post in widget
- WordPress – show all posts + ones with specific tag
- How does add_action ‘comment_post’ work?
- Custom action on comment post
- WordPress most commented posts of last X days
- How do I call comments_template(); from a plugin file?
- How to convert my comment.html to comment.php
- how to loop through blog posts in php
- The search doesn’t work properly
- Pre_get_comments and orderby comment_karma
- Count post with tags within one category?
- Getting checkboxes for some tags in a search box
- How to change product title color in shop page if product has specific product tag (Woocommerce)?
- Remove links to the comments section