I'm having to fix a WordPress plugin made by a different developer who can no longer be contacted by the WordPress site owner. The plugin is supposed to display a content box if a post is of a specified type. Digging into the plugin, I seemed to have found the function, and it basically uses strpos to search the post url for "review". The problem here is that if the post URL has "review" in any word (like "preview") the plugin activates and the content box is displayed, when the WordPress site owner does not want to have the content of the plugin display on posts that say something like "Preview".
So is there a way to change this bit of code so that only when the url contains "review" the plugin triggers, but "review" as it's own word and not part of another word?
This is kind of tough to verbalize, but I hope the problem is clear enough.
Alternatively, would there be a way to change the function so that only posts in a specific category would trigger this plugin?
I have looked in the string area of the php manual but I can't seem to find a function that would fix my problem, or am I well versed enough in php to greatly modify the lines of code on my own.
$current_url = home_url( $wp->request );
//error_log( $current_url );
if( strpos( $current_url, "review" ) === false ){
//error_log( 'here return' );
return $content;
Posts containing "preview" in the url trigger the plugin, when that is not the desired behavior.