Inline style removed by WordPress

  • I have noticed that WordPress is removing some inline styles. How do I stop this from happening?

    Specifically it is removing page-break-inside:avoid; If I inspect the page, I see this style is not there and if I add it back in using Devtools in Chrome the page goes back to working as I would expect.

    I believe this is a recent change, i.e. in the last month, because last months post now looks different to when I published it, as a result of this inline style being removed.

    Please can you put it back to the way it was and not remove inline styles. You don’t know why they are there. You shouldn’t just randomly remove them!

    The blog I need help with is: (visible only to logged in users)

  • Irritatingly, I can’t even fix the layout problem this has resulted in by adding in a page-break-before: always; on the inline style instead as this is also removed!

    P.S. If you want an example post, see https://mqgem.wordpress.com/2022/11/29/mqgem-monthly-2022-11/ and see how there is a title at the bottom of column 1 which shouldn’t have a page break after it, it should be at the top of column 2 with its subsequent text. Just looks ugly now and I can’t fix the layout because you are removing the inline styles that would fix it.

  • OMG it’s actually much much worse than I realised. It is physically DELETING parts of my inline styles from my posts when I save as draft. The above mentioned styles and also the last semi-colon on every inline style statement. What is going on? Each time I save as draft it tells me that the version I am looking at is not the same as the backup saved in the browser and when I restore that backup it puts the styles and semi-colons back in and then I save as draft again and it deletes them again. OMG I don’t need this right now – I have to get this published.

  • Hello there,

    Many thanks for reaching out – can you tell me what inline styles in particular are being deleted please?

    Also, I notice that a table is being entered into a classic block in the classic editor, which may have something to do with the deletion somewhere along the line.

    You may wish enter in the content via the classic editor. This can be done by going here: https://mqgem.wordpress.com/wp-admin/edit.php > hover a post and click “Edit with Classic Editor”.

    I hope this helps so far.

  • as mentioned in the opening post one of the removed styles is page-break-inside:avoid

    I am writing all my posts with the classic editor. What about the post suggests otherwise? I don’t go anywhere near blocks. I do use the copy facility which seems to open it in the other editor but I just save as draft and then edit in classic from then on.

    I did do an experiment with avoiding that copy step as I did wonder about that but even a post solely created with the classic editor displays the same behavior. Does it happen for you?

  • Hi @moraghughson, would you happen to have an existing post (not recently edited) that uses this attribute and where it is preserved?

    I’m doing some digging on this and it looks like certain attributes are supported only with the Premium plan and up. And you have that, I’d recommend using “additional css” and classes rather than inline styles wherever possible.

    Still, if this attribute was working before, we’ll want to share that with the developers. Thanks in advance.

    Also, please be mindful the classic editor will retire at some point. I don’t know when, but I do know we won’t have a lot of control over its retirement, and I also know the block editor has been out for several years now. I’d recommend using blocks and reporting any issues you have with them so we can get those sorted out. Thanks!

  • Here’s one where the styles are still present: https://mqgem.wordpress.com/2022/09/30/mqgem-monthly-2022-09/

    I don’t understand the logic of disallowing inline styles on accounts that don’t have the option to use CSS. I have no option to use CSS so I have no choice but to use inline styles. I wouldn’t do it this way if I had any other choice, but I have no budget to buy premium plans. I thought inline styles was in some way the medicine you took for being on the free plan, but now it would appear the penalty is even worse. Is WordPress just trying to get rid of its free users now?

    I am hugely disappointed to hear that the classic editor might be removed. I’m sure someone told me before that it wasn’t going anywhere. I simply hate the block editor. It is clunky and gives you no control of what you are doing. I prefer creating in HTML and I dislike something editing my HTML when I did not ask it to do so. I even avoid switching from text to visual in the classic editor because that reformats your lines, but at least it didn’t delete stuff you needed.

  • Is WordPress just trying to get rid of its free users now?

    I won’t say a definitive answer since WP would ban me for giving out “false” info, but if you look at all the decisions WP has made over the last 3-4 years with their editors and plans, there is only one obvious conclusion you can come to. You have my sympathy.

  • Hi again @aleone89 – just wondering if you had any more thoughts? You said that it looked like my table was “being entered into a classic block in the classic editor, which may have something to do with the deletion somewhere along the line.” Could you reply to explain what that meant? If there is something I can do to avoid the deletion I am all ears.

    Your comment also suggests that maybe this isn’t supposed to happen. I would also love to hear more about that. Under what situations would this be expected, and under what situations is it not supposed to happen.

    There have been some comments suggesting I need to buy a plan to avoid this. Could you tell me what I need to purchase to have my HTML left exactly as I edited it.

  • Hi again @supernovia , were you able to find out anything from the developers about whether these deletions were deliberate?

    Same question I asked your colleague; could you tell me what I need to purchase to have my HTML left exactly as I edited it.

  • Hello @moraghughson

    If I’m honest, I’m not 100% if there’s currently a bug with the product, or perhaps a gap with our documentation and it’s something @supernovia is digging into.

    There’s nothing here currently https://wordpress.com/support/code/#html-tags about inline CSS not being allowed under certain plans, but if this is the case, it should be determined and clearly stated.

     “being entered into a classic block in the classic editor, which may have something to do with the deletion somewhere along the line.” Could you reply to explain what that meant?

    Because the block editor adds HTML to help make blocks work, we have seen some things happening. Inline CSS, with the block editor is unusual, even if entered via a classic block – so it’s not out of the realms of possibility that there could be a bug at foot with these two processes.

    There have been some comments suggesting I need to buy a plan to avoid this. Could you tell me what I need to purchase to have my HTML left exactly as I edited it.

    We’ll be sure to let you know!

  • Hi @aleone89 – thanks for your reply.

    I guess I misunderstood you. I got the impression that you had seen something in my blog post HTML that made you say, “I notice that a table is being entered into a classic block in the classic editor…” – but I guess you were referring to something else.

    For the avoidance of doubt, my blog posts are written using the classic editor, not the classic block. Although, since the copy post function started working a few months back, I do use that feature now, which does pump the blog post through the new editor initially. However, I have ruled that out as a cause because I see the same deletions when I create a post brand new only in the classic editor. So I don’t think it is anything to do with the new editor.

    I will await a response from @supernovia on what she manages to find out.

    Cheers,
    Morag

  • Hello Morag,

    but I guess you were referring to something else… which does pump the blog post through the new editor initially….

    Yeah, for me it’s the combination of inline CSS and the block editor that has got my spidey senses tingling.

    I’m really curious, so feel free not to answer – but I’m wondering why the newsletter posts are put together using HTML and not using the block editor…I’m wondering if there’s some future proofing that could be applied with this particular issue.

  • Because I love writing in HTML, and I’ve been doing it for longer than the block editor has existed. I have developed the template for the newsletter over many years to what it is now.

  • Hi @supernovia,

    It seems that WordPress is removing inline styles that are CSS3, as it did many years ago.

    For example, I recently edited an old post that includes a text box with a scrollbar and a shadow underneath. When I saved the post the styling on the text box was ruined. It appears that WordPress removed the box-shadow, overflow-x, and overflow-y properties.

    You can see the text box, after I added the CSS2 ‘overflow’ property, here: https://noamsark.org/2014/09/17/enemy-within-an-indicator-for-murder/#honeybadger

    And, you can see an old post that includes a text box that uses these CSS3 properties here: https://noamsark.org/2012/11/11/gmo-maize-causes-cancer-hype/

    (Both links are in Hebrew.)

    Cheers,
    Noam

  • @nleviatan thank you for that report. I’ve passed it on to our devs, and we will report back here when we have more info, thanks!

  • When I read @nleviatan ‘s post it gave me some hope that perhaps I was using a CSS3 property and that if I changed it to a CSS2 property then I would be working again. Alas, that hope was dashed. page-break-inside is a CSS2 property. The CSS3 equivalent is break-inside. I have tried both and both are removed. So I guess WordPress just has a list of inline styles it just doesn’t like for some other reason, and it is removing all of them (and the final semi-colon just to irritate the pedants among us).

    Any news on this one btw? Including the question on what I have to buy in order to avoid this from being done to me?

  • Hello there,

    Sorry to see this is still going on…

    Any news on this one btw? Including the question on what I have to buy in order to avoid this from being done to me?

    We would love to recommend a plan to you, but for this particular instance, it wouldn’t solve the issue, so it would be disingenuous for us to do so.

    This is down to a core WordPress problem and a ticket has been opened here: https://core.trac.wordpress.org/ticket/57434#ticket which can be followed.

  • Hello there,

    Sorry to see this is still going on…

    Any news on this one btw? Including the question on what I have to buy in order to avoid this from being done to me?

    We would love to recommend a plan to you, but for this particular instance, it wouldn’t solve the issue, so it would be disingenuous for us to do so.

    This is down to a core WordPress problem and a ticket has been opened here: https://core.trac.wordpress.org/ticket/57434#ticket which can be followed.

  • interesting to see it categorized as a new feature when it is something that worked 2 or 3 months ago. Why not a defect?

  • The topic ‘Inline style removed by WordPress’ is closed to new replies.