Checking if a post contains an html tag

by Wali Muhammad Khubaib   Last Updated September 13, 2018 06:08 AM

How can i check whether a post contains an html tag or not. suppose someone has posted an image on the post to i want to see on if the post contains an <img> tag similarly if there is a link so i want to check for the <a> tag. So is there some way i can achieve this so i can perform actions based on whether it has a particular tag or not.

I tried the has_tag() function but then realized that i refers to the wordpress post tags and then i tried to use the has_term but couldn't figure out how to work with it or maybe it's not the right function as well.

Tags : posts html

Related Questions

Is Hfeed class for all pages needed

Updated May 27, 2015 23:03 PM

Wordpress creating wrong grid

Updated March 22, 2017 10:08 AM