Archived topic
Affiliate links stripped from Element content
11 replies · Started by Dan on December 10, 2022
I use the ThirstyAffiliates plugin and have discovered that when I use them in an Element, the link gets removed.
To demonstrate this, I created a test page on my staging site. Only ThirstyAffilliate and GP plugins are enabled.
On the page I inserted an affiliate link using the standard post editor and then inserted the same link using a hooked block Element. The link to the test page is in the private section. You will see that one link works fine, while the other is no longer a link and is styled differently.
Inspecting these two links, you'll see that the one inserted using the element has had className: "thirstylink" stripped from it, which maybe the cause of the problem. Why?
When inserting the affiliate link in the Element builder page, it works just fine. It only breaks on output.
Hi there,
The element module doesn't have the ability to strip anything or alter the HTML output.
When I view the source, I'm seeing a <ta> tag:
https://www.screencast.com/t/vNYNVBJAIdbp
Is that supposed to be correct? I've never seen a <ta> tag and Google research didn't come up with anything either.
It has the tag, but the class has been removed.
Here is the link output from the element: https://capture.dropbox.com/kfJxJLfgPaYsE57r
Here is the same link output from the regular post editor: https://capture.dropbox.com/xR2417QJfzTYrZlV
Click the link in chrome inspector and go to the properties tab to view this info yourself.
Can you check with ThirstyAffiliates's support team to see if they have any idea what would be causing this?
The element module is simply a custom post type and nothing special - it really doesn't have the ability to strip anything.
I can't recall another mention of HTML being altered in Element either.
You might want to go through some debugging steps like disabling all plugins except GP Premium and ThirstyAffiliates to make sure there aren't any odd conflicts happening either.
That is strange because I have output ThirstyAffiliate links in other custom post types with no problem. I will ask the TA people, but can you also ask around your other support agents to see if they have seen anything like this?
"You might want to go through some debugging steps like disabling all plugins except GP Premium and ThirstyAffiliates to make sure there aren’t any odd conflicts happening either."
Yes, I already did that. TA and GP Premium are the only plugins running on the staging site I sent you a link to.
but can you also ask around your other support agents to see if they have seen anything like this?
Will do!
Another idea to test, can you use a hook function instead of the element to add it and see if that works?
https://docs.generatepress.com/article/using-hooks/
Hi there,
1. How are these added top the page ? Are they HTML or are they a Shortcode ?
2. What is the <ta> tag Leo referred to ? - see here:
Hi David. I created a quick screen capture vid that I think answers both of those questions. It's posted in the private section.
Thanks for that - its super helpful.
So we can assume that the TA plugin is doing something to swap out the <ta> for an <a> and make good all the other things on the front end.
But as we know thats not happening if its an element.
So question is - how are they doing that and what does it involve?
Is it possible to ask them considering the following things that i see as being potentially an issue:
1. The content from the element is hooked in OUTSIDE of the loop. So it would not be picked up with the_content filter hook.
2. The Element CPT is not publicly queryalble ( 'publicly_queryable' => false, ) so if they are using a WP Query or something similrat they wouldn't find them.
Great. Thanks for your input. I will pose this question to them.
Let us know what you find :)