HTML tags are being stripped when I copy a post

  • Author
    Posts
  • #833302

    stamcell
    Member

    Hi,
    I’ve noticed that when I copy a post (containing HTML tags) that some of the tags (mainly <span> and <p>) are being stripped from the new post. Why would this be happening?

    The blog I need help with is stamfordstamcell.wordpress.com.

    #833517

    timethief
    Member

    Will you please post a link to the post or page this is happening in? I suspect you are using deprecated code.

    #833519

    timethief
    Member

    Also when you say “copy a post” are you doing that manually? Or are you using the copy a post feature?

    #833537

    stamcell
    Member

    Thanks for your reply – yep if you look at this:
    http://stamfordstamcell.wordpress.com/category/02-april-2012/
    you can see the headers in the second post look wrong, I am using <h1><span>header</span></h1>. I have already gone in and replaced the span tags but it has stripped it out again. I am also using the copy a post feature.
    The strange thing is I am using the same tags on:
    http://stamfordstamcell.wordpress.com/category/01-march-2012/
    and it’s working fine?

    #833543

    justpi
    Member

    A plain span tag pair enclosing the same text that’s enclosed in an h tag pair is meaningless. What exactly are you trying to do?

    #833548

    stamcell
    Member

    It’s an image replacement technique – I place a header graphic in the H1 tag using css and then display:none on the span. Yes I know not a perfect solution but it’s just for an internal work newsletter and I want to keep it as ‘semantic’ as possible by keeping the H1 tags.

    #833584

    justpi
    Member

    Well, the post editor doesn’t know that!
    See here for possible alternatives:
    http://css-tricks.com/css-image-replacement/

    #833593

    stamcell
    Member

    It doesn’t really matter why I want to do it, I just want to know why the span and sometimes p tags are being removed from the post, when they are not being removed on other posts – if they were being stripped from all the other posts then maybe I’d make the assumption that wordpress doesn’t like that combination of code but that’s not the case.
    Thank you for posting that link though, very interesting article

    #833595

    justpi
    Member

    You’re welcome.

    The editor strips wrong code (or code it considers wrong) when you swirch to Visual.

    #833596

    stamcell
    Member

    hmm ok, even though *technically* there’s nothing wrong with it. Looks like I’ll have to use another method, thanks for your help

The topic ‘HTML tags are being stripped when I copy a post’ is closed to new replies.