[wordpress插件] A Fresher Cache较新的缓存

wordpress 插件 文章 2020-01-22 23:00 550 0 全屏看文

AI助手支持GPT4.0

评分

100

100

描述

A Fresher Cache adds an admin bar menu that gives easy access to functions that refresh (i.e, regenerate or invalidate)

Fresher Cache添加了一个管理栏菜单,该菜单栏使您可以轻松访问刷新功能(即重新生成或无效)

cached items.

缓存的项目。

Out of the box, the plugin provides easy access to refresh items that WordPress Core caches;

开箱即用,该插件可轻松访问WordPress Core缓存的刷新项目。

however, the true

但是,真正的

power of the plugin is its API that allows developers to easily add items to the menu that initiate custom functions that

插件的强大功能是它的API,它使开发人员可以轻松地向菜单中添加项目以启动自定义功能,这些功能

refresh cached items.

刷新缓存的项目。

For instance, imagine that you wrote a function called “my_update_all_term_caches” that loops through all of the terms

例如,假设您编写了一个名为“ my_update_all_term_caches”的函数,该函数遍历所有术语

in your WordPress install and updates the cache for each item.

在WordPress中安装并更新每个项目的缓存。

You can add this function to the “Freshen” admin bar

您可以将此功能添加到“ Freshen”管理栏

menu with the following API call:

带有以下API调用的菜单:

function my_update_all_term_caches_menu_item() {    

  function my_update_all_term_caches_menu_item(){    

$args = array(        

$ args =数组(        

'id' => 'my-update-all-term-caches',        

'id'=>'my-update-all-term-caches',        

'title' => 'Update Term Cache',        

'title'=>'Update Term Cache',        

'function' => 'my_update_all_term_caches'    

'功能'=>'my_update_all_term_caches'    

);    

);    

afc_add_item( $args );

afc_add_item($ args);

}

}

add_action( 'init', 'my_update_all_term_caches_menu_item' );

add_action('init','my_update_all_term_caches_menu_item');

This code will generate a menu item labelled “Update Term Cache” that creates a link that will run the function defined

此代码将生成一个标签为“ Update Term Cache”的菜单项,该菜单项创建一个链接,该链接将运行定义的功能

in the “function” key of the $args array (in this case, my_update_all_term_caches()).

在$ args数组的“功能”键(在本例中为my_update_all_term_caches())中。

The primary purpose of this plugin is to provide an easy tool for developers to refresh cached items when developing new

此插件的主要目的是为开发人员提供一个简单的工具,使其在开发新产品时刷新缓存的项目。

features.

特征。

Additionally, it can serve as a convenient tool for users to be able to update cached items when needed.

此外,它可以作为方便的工具,使用户能够在需要时更新缓存的项目。

Note that this is not merely a wrapper for the admin bar API.

请注意,这不仅是管理栏API的包装。

Rather, it allows you to add items to the admin bar and provides

相反,它允许您将项目添加到管理栏中并提供

all of the necessary coding that will link a callback function to a menu item.

将回调函数链接到菜单项的所有必要编码。

You can think of it as an extension of

您可以将其视为
的扩展

the admin bar that adds a very specific functionality.

管理栏,添加了非常特定的功能。

The plugin also uses the admin bar as intended and only adds a

该插件还按预期使用了管理栏,仅添加了一个

few extra arguments that support the functionality of this plugin.

支持该插件功能的一些额外参数。

A more complete tutorial that describes the full functionality of the plugin can be read at

可以在以下网址阅读更完整的教程,其中描述了插件的全部功能:

tollmanz.com.

tollmanz.com 。

安装步骤

    1. Upload a-fresher-cache folder to the /wp-content/plugins/ directory
    2. a-fresher-cache 文件夹上载到 / wp-content / plugins / 目录

    3. Activate the plugin through the “Plugins” menu in WordPress
    4. 通过WordPress中的“插件”菜单激活插件

    5. See above to start adding custom items to the “Freshen” admin menu item
    6. 请参见上文,开始将自定义项目添加到“ Freshen”管理菜单项中

下载地址

https://downloads.wordpress.org/plugin/a-fresher-cache.0.2.0.zip

https://downloads.wordpress.org/plugin/a-fresher-cache.0.2.0.zip

-EOF-

AI助手支持GPT4.0