Automate the conversion of inline CSS to a CSS stylesheet in WordPress?

Let’s imagine we have a WordPress website with numerous posts containing text formatted with inline CSS, and we want to move all that CSS to a stylesheet to apply it to the text and then remove all the inline CSS in the beginning. Assuming the website is ours, and we have access credentials if needed, if we want to automate this entire process, what would be the best approach?

I think Python would be the best language, but how would you structure the script/program, and what elements would you access? Would you interact with the frontend or directly with the database, for example? What methods and libraries do you consider most suitable and efficient to make the code work as effectively as possible?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.