The WordPress and the vanishing html elements

Are you looking for a solution to any of the following probelm

"html elements are not working in wordpress post",
"iframe tag is getting stripped in the post after update",
"script tags are vanishing after updating the post",
"not able to use any html elements in the post"
"Not able to insert script into wordpress post"

Cause, I have been there too and found the following solutions to be useful.

There are so many solution you might have stumbled upon while searching for a fix to this issues. Yes I did too.

Here are some of them I found to be working like a charm.

Solution 1:

Script n Styles Plugin :

There are so many plugins I have tried and I found this one to be meeting the objective of  its creation.

you can apply scripts and styles globally at every page, It allows you to write various flavours of  CSS and Java Script and also enables you to control where to add the script/style, in the header, or body etc.




Solution 2:

Shortcoder Plugin

you can write CSS, Javascript, HTML and create a shortcode and use it in your post



Copy the shortcode given, into the post (or) page where you want this code.


Thats it. the result will be perfect.


Solution 3

In case if you have constraints that you cannot install the plugin for performance reason and wanted to do it without plugin. I would recommend creating the shortcode by yourself. Yes we can create shortcode without any plugin.

In order to do that you should be having access to the hosting FTP as it has to be done in the configuration file level.


all we have to do is the following

  • Add the html/script code that you want to add into the variable
  • Return it inside the function
  • Assign the function to short code using add_shortcode function

here is the sample

function titlecode(){
return $outhtml;

Now we can use the shortcode in our page and test.



Hope it helps.