Reputation: 4642
I'm trying to create a wordpress site and I am trying to add the following into a page, using the text editor on the wp-admin:
<a target="divtarget" id="link">
<!---
...
-->
</a>
The problem is, whenever I edit it, it shows on the site. Then when I go back, edit it again, it is no longer there. I can't seem to figure out why, I assume that it's because HTML tags are not supported in the visual mode.
Is there a way to disable this so the tags are enabled and I can edit them?
Upvotes: 0
Views: 3556
Reputation: 783
You can try this hook if some tags can't be visible in your editor.
https://ben.lobaugh.net/blog/201762/add-html-tags-to-the-allowed-tags-list-in-wordpress
Upvotes: 0
Reputation: 699
As I said, raw html
input is only possible if you turn the visual mode
off in the Wordpress Editor.
Have a look at this example:
This way you can easily switch between the two modes.
To permanently turn off the visual mode you have to do this:
Users -> Authors & Profile
Find your username and click on Edit.
Uncheck "Visual Editor"
Upvotes: 4
Reputation: 1128
No, I think it's ok. To edit HTML tags, you must switch from visual mode to text mode. The visual editor is something like MS Word. You can't even paste HTML in it to make it rendered.
When you paste HTML in visual mode, the code is shown on the page bacuase wordpress encodes HTML from the visual mode with htmlspecialchars()
. In text mode, wordpress dosen't encode your code.
For the PHP reference for this look at http://php.net/manual/de/function.htmlspecialchars.php
If you only want to write in text mode you can turn off visual mode in your wordpress userprofile.
Hope it helps ;)
Upvotes: 0