I am trying to figure out I can only execute my plugin on the single post page rather than the main index page. It is ignoring the tag which I thought would resolve this issue.
Currently, this is how it is working:
add_action('the_content', 'my_plugin');
I tried detecting the but it would return false all time. I thought it would be removed on the single post pages:
if (strpos($post_content, '<!--more-->')) {
return false;
}
There is probably a better hook for this but I am definitely a newbie.
Do this right after
the_post();or right before you call the_content;
By the way, the best way to make sure that something is not ran on the homepage is by check if it is the home page. Try this:
if(!is_home()) { // Run Plugin }