iranimij / wp-options-manager
您可以通过这个库轻松管理您的插件选项
1.0.6
2022-12-07 13:34 UTC
README
使用这个库,您可以轻松以最佳和最有效的方式管理插件选项。
如何安装库
在项目中安装此库的推荐方法是使用Composer加载
composer require iranimij/wp-options-manager
如何使用此库
// Updating an option wp_options_manager()->update( 'test-option-key', 'test-option-value' )->save(); // Updating two options in a row wp_options_manager()->update( 'test-option-key', 'test-option-value' )->update( 'test-option-key2', 'test-option-value2' )->save(); // Updating multiple keys in just one array wp_options_manager()->update( [ 'first-key' => 'first-value', 'second-key' => 'second-value', 'third-key' => 'third-value', ] )->save(); // Getting an option => Output = 'test-option-value wp_options_manager()->select( 'test-option-key' ); // Deleting an option wp_options_manager()->delete( 'test-option-key' );
我们可以在数据库中找到哪些数据
所有数据都保存在数据库选项表中的一个键中。键名完全等于您插件的slug。名称将自动选择。