I am looking to write a plugin that executes code on individual post pages but does not try to execute that code in search results or archives or anything that shows multiple posts in one place. I tried using a filter on "the_content", but that seems to execute everywhere. Seems this would be a simple thing to find out, but the dual meaning of the word "filter" has made searching for this pretty difficult.
As a related question, is there a good source for seeing what filters and actions are fired for different types of pages in a theme? I’m sure I’ll have a similar problem in the future, and learning to fish will be helpful here.
Many thanks.
2
Answers
You need to create a condition where you specify that your code should only be executed on the single post or product
And maybe this code will be a good guide for you