A bug found
-
Line 57:
if ( strpos($post->post_content, $pattern))
If your keyword is the very first word, strpos will return position 0, which will cause this to fail.
Instead, it should be:
if ( strpos($post->post_content, $pattern) !== false)
Also, I prefer a case insensitive search. In that case:
if ( stripos($post->post_content, $pattern) !== false)
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘A bug found’ is closed to new replies.