I'm writing this because I notice that this question has been closed as a dupe of this. This is wrong, for a reason I am about to explain below. I left a comment on the question asking for it to be reopened, but I feel like a meta post is necessary so that no one makes the same mistake in the future.
The topics of the questions here are, how to test for an item's custom name with commands in Minecraft. The duplicate target here explains why testing for custom item names in this way is bad practice.
For a problem like this, there are two possible scenarios here. The difference is if the asker is using the custom item name decoratively or non-decoratively:
Decoratively: The asker has made a custom item for their map, and they are using a custom item name as part of the decoration for that item. In this case, the solution in the duplicate applies. The asker should be using a custom item tag.
For example, "How do I detect a player holding my custom trident?", if the question contains a command testing for a custom item name, it should be closed as dupe.
Non-decoratively: The whole point of the system is that it needs to detect the item having the custom name. For example, a map that needs to detect when you rename a piece of paper.
For example, "How do I detect a player renaming a piece of paper to 'John'?" should not be closed as duplicate, because adding a custom item tag doesn't help there.
As for the original question that was incorrectly closed, it is incorrectly closed because it is inconclusive whether this falls under the first or second scenario above. Inconclusiveness does not default to the side of closure. If it is inconclusive, a comment should be left and no further action until it is clear which scenario the question is leaning towards.
If you believe my self-answered question needs an edit or two to make this distinction more clear, feel free, I don't mind.