Hi,
I am using a contact page plugin for my blog.The shortcode using for this is
[my-shortcode]
.
Is there anyways to filter only the shortcode from the content.
Eg:
Test post [my-shortcode] Demo widget
.here i need to filter only the shortcode.Thank you
views:
17answers:
1
A:
You can use regex to get the value of brackets within a string like so.
if(preg_match_all('/\[(.*?)\]/',$_POST['my_key'],$matches))
{
foreach($matches as $match)
{
if($match[1] == 'my-short-code')
{
//Do whetever
break 2;
}
}
}
Note: match[1]
may be match[0]
RobertPitt
2010-09-17 11:08:44
thank you so much
Guest Visitor
2010-09-17 11:23:28