I have a custom post type called newsletter. At the same time, an implemented analytics tool (not related to my CPT) uses newsletter as a GET parameter to track some incoming links (and I can’t change this).
Say, I have
/?newsletter=value_for_analytics_tool
This will lead to an 404 error page, as WordPress obviously tries to find a post in my newsletter CPT. But actually, I just want the main page to show up and keep the newsletter parameter for the analytics tool.
Is there any way to 'ignore' GET parameters, but keep my CPT working?
I have a custom post type called newsletter. At the same time, an implemented analytics tool (not related to my CPT) uses newsletter as a GET parameter to track some incoming links (and I can’t change this).
Say, I have
https://www.example/?newsletter=value_for_analytics_tool
This will lead to an 404 error page, as WordPress obviously tries to find a post in my newsletter CPT. But actually, I just want the main page to show up and keep the newsletter parameter for the analytics tool.
Is there any way to 'ignore' GET parameters, but keep my CPT working?
Share Improve this question asked Jan 29, 2020 at 13:52 mischnumischnu 115 bronze badges1 Answer
Reset to default 0You should always preface your CPT names with something to avoid stuff like this - common naming leads to conflicts. My recommendation, so that you avoid this happening again would be to go and re-work your CPT code in your plugin/theme and use myplug_newsletter
as the name of your CPT. Obviously change the myplug_ to something unique to you.