节省空间占用:删除WordPress文章同时删除内容包含的图片-WordPress主题

摘要:在我们编辑文章时通常会添加一些图片,达成图文混排的效果,但是如果我们遇到删除文章时,文章中的图片并不会一同被删除掉,图片…

在我们编辑文章时通常会添加一些图片,达成图文混排的效果,但是如果我们遇到删除文章时,文章中的图片并不会一同被删除掉,图片还是会留在服务器中无形中占用了服务器资源,那我们有没有一种办法可以在删除文章的同时将文章中的图片一起删除掉?

只需要将代码添加到当前wordpress主题的Functions.php文件中。

来源:http://www.wazhuti.com/2316.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_13179.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?