博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
wordpress自动发布_如何在WordPress中控制发布修订
阅读量:2508 次
发布时间:2019-05-11

本文共 3539 字,大约阅读时间需要 11 分钟。

wordpress自动发布

WordPress revisions

WordPress automatically creates revisions of your content. Whenever you save a post or a page, the old version is retained so you can revert back at any time. Older revisions are never deleted so you always have a full history of all page changes.However, sometimes it’s necessary to do a little housekeeping. Every revision requires a separate row in WordPress’s posts table and perhaps multiple entries in the postmeta and term_relationships tables. Removing older revisions will free up disk space and ease MySQL’s processing burden.

WordPress自动创建您内容的修订版。 每当您保存帖子或页面时,都会保留旧版本,因此您可以随时还原。 较旧的修订版不会被删除,因此您始终拥有所有页面更改的完整历史记录。但是,有时需要做一些整理工作。 每个修订都需要在WordPress的posts表中单独放置一行,并在postmeta和term_relationships表中可能需要多个条目。 删除较旧的修订版将释放磁盘空间并减轻MySQL的处理负担。

删除旧修订 (Removing old revisions)

I’m going to say this only once: BACK UP YOUR DATABASE! We’re about to run SQL statements directly on your MySQL tables and one tiny slip could trash your WordPress installation.First, you need to find your WordPress table prefix which is specified in the following line of wp-config.php:

我只说一次: 备份您的数据库! 我们将直接在MySQL表上运行SQL语句,一个小小的错误就可能破坏WordPress安装。首先,您需要找到wp-config.php的以下行中指定的WordPress表前缀:

$table_prefix  = 'wp_';

wp_ is the default but it can be changed to give your installation a little additional security. We’ll assume wp_ has been specified in the following code.To delete all revisions for all pages and posts, start a MySQL administration tool such as and run the following SQL statement:

wp_是默认设置,但是可以更改它以为您的安装提供一些额外的安全性。 我们假设在以下代码中指定了wp_。要删除所有页面和帖子的所有修订,请启动MySQL管理工具(例如并运行以下SQL语句:

DELETE a,b,cFROM wp_posts a  LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)  LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)  WHERE a.post_type = 'revision';

(Remember to change all table references from “wp_” to your table prefix if necessary.)

(必要时请记住将所有表引用从“ wp_”更改为表前缀。)

tip: SQL Shenanigans
提示: SQL Shenanigans

Many thanks to Michael Ambrosio for highlighting a subtle problem with this SQL statement which can cause WordPress links to be deleted.

非常感谢Michael Ambrosio突出显示了此SQL语句的一个细微问题,该问题可能导致WordPress链接被删除。

If that’s a little too severe, you could remove all revisions prior to a specific date, e.g. the following statement will remove all revisions except for those made after January 1, 2010:

如果这有点太严厉,则可以删除特定日期之前的所有修订,例如,以下语句将删除除2010年1月1日之后所做的所有修订:

DELETE a,b,cFROM wp_posts a  LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)  LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)  WHERE a.post_type = 'revision'AND a.post_date < '2010-01-01';

(Note that MySQL dates are specified using YYYY-MM-DD notation.)

(请注意,MySQL日期是使用YYYY-MM-DD表示法指定的。)

禁用或限制修订 (Disabling or limiting revisions)

Add the following statement to your WordPress wp-config.php file to permanently switch off post revisions:

将以下语句添加到WordPress wp-config.php文件中以永久关闭发布修订:

define('WP_POST_REVISIONS', false);

The value can be set to ‘true’ to re-enable revisions.Alternatively, you can use a positive integer to limit the number of permitted revisions, e.g.

可以将值设置为“ true”以重新启用修订。或者,您可以使用正整数来限制允许的修订数量,例如

define('WP_POST_REVISIONS', 5);

This will create a maximum of 5 revisions per post, plus one for auto-saving purposes. Older revisions will be automatically deleted.

每个帖子最多可创建5个修订,另外还有1个用于自动保存。 较旧的修订版将被自动删除。

WordPress插件 (WordPress plugins)

If this all sounds a little too scary, you’ll be pleased to know that there are a number of .Do you have any further tips for controlling WordPress revisions?

如果这一切听起来有点吓人,您会很高兴知道有许多的 。您还有其他控制WordPress版本的提示吗?

翻译自:

wordpress自动发布

转载地址:http://qdrgb.baihongyu.com/

你可能感兴趣的文章
flex布局
查看>>
python-----python的文件操作
查看>>
java Graphics2d消除锯齿,使字体平滑显示
查看>>
控件中添加的成员变量value和control的区别
查看>>
Spring Boot Docker 实战
查看>>
Div Vertical Menu ver3
查看>>
Git简明操作
查看>>
InnoDB为什么要使用auto_Increment
查看>>
课堂练习之买书打折最便宜
查看>>
定义函数
查看>>
网络虚拟化技术(二): TUN/TAP MACVLAN MACVTAP
查看>>
MQTT协议笔记之mqtt.io项目HTTP协议支持
查看>>
(转)jQuery中append(),prepend()与after(),before()的区别
查看>>
Tecplot: Legend和图像中 Dashed/Dash dot/Long dash 等虚线显示没有区别的问题
查看>>
蜕变成蝶~Linux设备驱动之异步通知和异步I/O
查看>>
jquery简单开始
查看>>
作业2
查看>>
ios上架报错90080,90087,90209,90125 解决办法
查看>>
给button添加UAC的小盾牌图标
查看>>
如何退出 vim
查看>>