wp-forge/wp-options
最新稳定版本:1.1.1
Composer 安装命令:
composer require wp-forge/wp-options
包简介
A WordPress helper class for managing plugin options.
README 文档
README
A WordPress helper class for managing plugin options.
Installation
composer require wp-forge/wp-options
Usage
Setting Options
<?php use WP_Forge\Options\Options; $options = new Options('my_plugin_options'); // Pass the option name and option value as parameters. $options->set('name', 'value');
Getting Options
<?php use WP_Forge\Options\Options; $options = new Options('my_plugin_options'); // Pass the option name and a default value as parameters. // If a default value is not provided, `null` will be the default return value. $options->get('name', 'default');
Deleting Options
<?php use WP_Forge\Options\Options; $options = new Options('my_plugin_options'); // Pass the option name to be deleted as a parameter. $options->delete('name');
Checking if an Option Exists
<?php use WP_Forge\Options\Options; $options = new Options('my_plugin_options'); // Pass the option name as a parameter. $options->has('name');
Saving Options
By default, options will save automatically on the shutdown hook.
However, if you'd like to force a save, you can do it like this:
<?php use WP_Forge\Options\Options; $options = new Options('my_plugin_options'); // Pass the option name and option value as parameters $options->save();
统计信息
- 总下载量: 160.31k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2022-03-04