• so i have this new problem with wp6.0 where blocks get classes applied and in the footer the styling gets added inside <style> tags. this is fine, until you switch out content via rest api. then some old styling might bring issues with the new content, respectively the styles of the new contents are missing. so as an example, if i load my home page, it has some block in there with .wp-container-1 and in the footer this container gets some styling attached to it. now when i change contents via ajax, this old styling stays the same and might affect my loaded contents, plus my loaded content is now missing its own styling. how do i get these missing styles? is there some function that i could call on rest_prepare_{$post_type} to insert these? any help is much appreciated.

    • This topic was modified 2 years, 4 months ago by jnz31.
    • This topic was modified 2 years, 4 months ago by jnz31.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Sorry for the late reply. I guess you haven’t received an answer yet because your question is a bit unclear.

    You are talking about some AJAX request that you use to store your content. Can you show this as a concrete example, with code? A link to the page that is affected is also welcome. It may also depend on the theme you are using, that would also be interesting to know.

    Thread Starter jnz31

    (@jnz31)

    hi @threadi
    well, no. you seem to not understand the underlaying issue here.
    usually, when loading a page/post and you use some sort of extra styling via gutenberg, these styles will be processed and attached on page load.

    but consider switching url and loading your stuff via rest api. then you get the contents, like title, content, featured image, etc. but the styling is missing. this has nothing to do with the request nor theme..

    for now i am using this solution.

    • This reply was modified 2 years, 4 months ago by jnz31.
    • This reply was modified 2 years, 4 months ago by jnz31.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘gutenberg styles into rest api’ is closed to new replies.