删除wordpress_如何在WordPress中管理和删除瞬态

删除wordpress

WordPress plugin and theme developers often use transients API to store timely information in your WordPress database.

WordPress插件和主题开发人员经常使用瞬态API将及时的信息存储在WordPress数据库中

This allows them to reuse this information and make their plugins function faster. While this is an incredible performance technique, sometimes it may affect your website during testing or development.

这使他们可以重用此信息,并使他们的插件运行更快。 尽管这是一种令人难以置信的性能技术,但有时它可能会在测试或开发过程中影响您的网站。

For example, you may realize that certain elements like popular posts or Twitter widgets are not changing despite emptying WordPress cache.

例如,您可能会意识到,尽管清空WordPress缓存,但流行帖子或Twitter小部件之类的某些元素并未更改。

That’s usually because the transient for that particular feature is not working as expected. To fix the issue, your options are to wait until transients expire or manually fix it.

通常是因为该特定功能的瞬态无法按预期工作。 要解决此问题,您的选择是等待瞬态终止或手动解决此问题。

In this article, we will show you how to easily manage and delete transients in WordPress.

在本文中,我们将向您展示如何轻松地管理和删除WordPress中的瞬态。

删除wordpress_如何在WordPress中管理和删除瞬态

什么是瞬态? (What is Transients?)

The Transients API in WordPress allows developers to store information in your WordPress database with an expiration time. This helps improve WordPress performance and speed up your website while reducing overall server load.

WordPress中的Transients API允许开发人员在有效期内将信息存储在WordPress数据库中。 这有助于提高WordPress性能并加快网站速度,同时减少总体服务器负载。

For example, many WordPress social media plugins use transients to retrieve and store share counts for posts.

例如,许多WordPress社交媒体插件使用瞬态来检索和存储帖子的共享计数。

If they didn’t use transients, then your server will need to connect with all social networks on each page load which will slow down your site significantly.

如果他们不使用瞬态,则您的服务器将需要在每次页面加载时与所有社交网络连接,这将大大降低您的网站速度。

删除wordpress_如何在WordPress中管理和删除瞬态

That’s why transients are awesome.

这就是瞬态很棒的原因。

Now you may be wondering, why would you ever want to manage or delete transients?

现在您可能想知道,为什么要管理或删除瞬变?

Well, things can go wrong sometimes. Let’s say a connection between Facebook and your site didn’t go so well, and now it’s showing a count of 0. You can wait 30 minutes or sometimes longer for a transient to expire, or you can clear out the transient cache and get the most accurate count.

好吧,有时候事情可能会出错。 假设Facebook与您的网站之间的连接状态不佳,现在显示为0。您可以等待30分钟甚至更长的时间以使瞬态失效,或者您可以清除瞬态缓存并获取最准确的计数。

It also helps when testing a plugin to make sure that it’s really working like it is supposed to.

在测试插件以确保其确实按预期工作时,它也有帮助。

Last but not least, you may want to delete expired transients to clear out your database. This comes in handy when you are moving a staging site to live WordPress hosting server.

最后但并非最不重要的一点是,您可能希望删除过期的瞬态以清除数据库。 当您将登台站点移至实时WordPress托管服务器时,这非常方便。

Are WordPress transients like cookies?

WordPress瞬变像cookie吗?

WordPress transients are like cookies but only in the sense that they both allow developers to store temporary information. However, transients are much more powerful.

WordPress瞬态就像cookie一样,但仅从某种意义上说,它们都允许开发人员存储临时信息。 但是,瞬变要强大得多。

For example, cookies are stored in the user’s browser and have several limitations. They are also less secure and not as programable.

例如,Cookie存储在用户的浏览器中,并具有一些限制。 它们的安全性也较差,也不容易编程。

Transients, on the other hand, are stored in the WordPress database, can store different types of data, more secure, and easily programmable with the transients API.

另一方面,瞬态存储在WordPress数据库中,可以存储不同类型的数据,更安全,并且可以使用瞬态API轻松编程。

That being said, let’s take a look at how to easily manage transients in WordPress and delete them when needed.

话虽如此,让我们看一下如何轻松管理WordPress中的瞬态并在需要时将其删除。

在WordPress中管理瞬态 (Managing Transients in WordPress)

First thing you need to do is install and activate the Transients Manager. For more details, see our step by step guide on how to install a WordPress plugin.

您需要做的第一件事是安装并**Transients Manager 。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。

Upon activation, you need to visit Tools » Transients page to view and manage transients used by your WordPress site.

**后,您需要访问工具»瞬态页面以查看和管理WordPress网站使用的瞬态。

删除wordpress_如何在WordPress中管理和删除瞬态

From here you will see a list of transients stored in your WordPress database.

从这里,您将看到存储在WordPress数据库中的瞬态列表。

This page lets you perform the following bulk actions:

该页面使您可以执行以下批量操作:

  • Delete expired transients

    删除过期的瞬变
  • Delete all transients with an expiry date

    删除所有具有到期日期的瞬变
  • Delete all transients

    删除所有瞬变

You can also look at transients listed below to edit or delete individual transients as needed. You can identify a transient by looking at its name.

您还可以查看下面列出的瞬变,以根据需要编辑或删除单个瞬变。 您可以通过查看瞬变的名称来识别瞬变。

Most trusted WordPress theme and plugin developers will use the product name in the transient to make it easily identifiable.

最受信任的WordPress主题和插件开发人员将在瞬态中使用产品名称,以使其易于识别。

Right next to the name column, you’ll see the value for each particular transient. The transients value could be an object, array, number or alphanumeric string as the value.

在名称列旁边,您会看到每个特定瞬态的值。 瞬态值可以是对象,数组,数字或字母数字字符串作为值。

You’ll also see an expiration time for each transient. Some of them may not have an expiration time set and will be displayed as ‘Does not expire’.

您还将看到每个瞬态的到期时间。 其中一些可能没有设置到期时间,将显示为“不到期”。

You can delete any of these transients or click on the Edit button to change their value.

您可以删除任何这些瞬变或单击“编辑”按钮以更改其值。

删除wordpress_如何在WordPress中管理和删除瞬态

This feature comes in handy when you are testing a theme or plugin and want to check it with different transient values.

当您测试主题或插件并希望使用不同的瞬态值进行检查时,此功能非常有用。

We hope this article helped you learn how to easily manage and delete transients in WordPress. You may also want to see our list of most useful WordPress tips, tricks, and hacks for more neat ideas to use WordPress like a pro.

我们希望本文能帮助您学习如何轻松地管理和删除WordPress中的瞬态。 您可能还想查看我们最有用的WordPress技巧,窍门和黑客列表,以获取更精巧的想法来像专业人士一样使用WordPress。

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress****。 您也可以在TwitterFacebook上找到我们。

翻译自: https://www.wpbeginner.com/plugins/how-to-manage-and-delete-transients-in-wordpress/

删除wordpress