admin管理员组文章数量:1332345
So, I added a custom.css file in my wordpress root, now I'm wondering if it will be deleted on the next core update. Is it safe to just leave it there? Can I also create custom folders and files inside other wordpress folders like wp-content?
So, I added a custom.css file in my wordpress root, now I'm wondering if it will be deleted on the next core update. Is it safe to just leave it there? Can I also create custom folders and files inside other wordpress folders like wp-content?
Share Improve this question edited Jun 23, 2020 at 11:58 fuxia♦ 107k38 gold badges255 silver badges459 bronze badges asked Jun 16, 2020 at 5:22 023023023023 1351 silver badge7 bronze badges3 Answers
Reset to default 1To answer your question directly. No the files won't get deleted when WordPress is updated. They will remain intact.
Taken from this link there are several other options for adding your own CSS, if you don't want to put it in the theme:
- Use Theme Options and paste in CSS
- Use a plugin to insert CSS/JS. You could also write your own plugin to 'host' the CSS file neatly in wp-content/plugins/ somewhere.
- Use a child theme, which will maintain your changes if your theme changes.
More info on each of these is in the link
Yes, those custom folders and files go inside the theme you're using. Wordpress groups files like HTML and CSS together in themes. What you should do is pop this CSS file in the directory of the theme you're using, and link to it there. Then it will definitely never get deleted, and then you have your own theme that you can apply to any Wordpress website.
So if your theme is called 'Nice Theme', you'll find a directory something like:
wp-content/themes/nice-theme
If there is a css directory in there, put your CSS in there, otherwise put it where it looks like it makes most sense, and update the point you refer to the CSS to include the extra part of the URL, e.g. if before the URL you used to load your CSS was:
https://yoursite/mycss.css
Then now it should be:
https://yoursite/wp-content/themes/nice-theme/mycss.css
本文标签: updatesIf I place custom files in Wordpress rootwill they be deleted
版权声明:本文标题:updates - If I place custom files in Wordpress root, will they be deleted? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742325115a2453563.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论