{"id":22266458,"url":"https://github.com/objectivco/wordpress-simple-settings","last_synced_at":"2025-07-28T10:32:57.864Z","repository":{"id":10396865,"uuid":"12548599","full_name":"Objectivco/wordpress-simple-settings","owner":"Objectivco","description":"A minimalist framework for managing WordPress plugin or theme settings. ","archived":false,"fork":false,"pushed_at":"2019-11-11T19:44:32.000Z","size":27,"stargazers_count":47,"open_issues_count":1,"forks_count":10,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-28T04:05:33.298Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Objectivco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-02T20:35:28.000Z","updated_at":"2023-02-11T18:03:27.000Z","dependencies_parsed_at":"2022-09-23T13:12:44.490Z","dependency_job_id":null,"html_url":"https://github.com/Objectivco/wordpress-simple-settings","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/Objectivco/wordpress-simple-settings","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Objectivco%2Fwordpress-simple-settings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Objectivco%2Fwordpress-simple-settings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Objectivco%2Fwordpress-simple-settings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Objectivco%2Fwordpress-simple-settings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Objectivco","download_url":"https://codeload.github.com/Objectivco/wordpress-simple-settings/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Objectivco%2Fwordpress-simple-settings/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267502642,"owners_count":24098188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-03T10:18:50.557Z","updated_at":"2025-07-28T10:32:57.561Z","avatar_url":"https://github.com/Objectivco.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"WordPress Simple Settings\n=========================\n\nA minimalist framework for managing WordPress plugin or theme settings.\n\nWhat Is This\n------------\n\nThis is a super simple framework for managing options in your WordPress plugin or theme. No cumbersome field section registration or other overhead is required.  Just add some settings, update them, get them. Whatever.\n\nIt handles nonces, field names, and etc magically!\n\nHow Does It Work\n----------------\n\nWordPress Simple Settings is an abstract class which you extend in your own plugin class, theme class, or wherever you need it.\n\nIt takes a prefix, set by you and builds a settings object which is stored in a single option in the database.\n\nThis last bit should be a clue to what type of data you should store using this API: small amounts!\n\nJust like the built-in Options API (which this framework uses!), you only want to use this for small bits of data.  Don't try to store your customer database here!\n\nInstallation\n------------\nThe best way is to use composer: `composer require objectivco/wordpress-simple-settings`\n\nYou can also clone the repository into your lib or inc directory and require `wordpress-simple-settings.php`. But composer is better.\n\nYou can get a quick idea of how to implement in our example plugin: `examples/awesome-plugin`.\n\nThe gist is, you'll instantiate your plugin class as extension of `WP_SimpleSettings`. You'll then set a prefix as a class variable called `$prefix`.\n\nIf you don't set `$prefix`, the framework will try to use your child class name.  But this will only work in PHP 5.3+.  So, really, just set a prefix ok?\n\nChange Log\n--------\n### 0.7.2\n- Pass NULL as old value if there isn't an old value.\n\n### 0.7.1\n- WordPress coding standards\n- Don't save to db for reach setting on save_settings(). Defer to the end.\n- Add action {$this-\u003eprefix}_update_setting_{$setting} that receives the old and new values during setting update.\n- Ignore .idea folder\n\n### 0.3.0\n- Added $delimeter variable to allow switching array delimeter from semi-colon (default) to something else.\n\n### 0.2.2\n- Added delete_setting.\n\n### 0.2.1\n- Fix location of {$this-\u003eprefix}_settings_saved action to prevent inappropriate firing.\n\n### 0.2\n- Improves storage and handling of array values.\n- Adds do_action(\"{$this-\u003eprefix}_settings_saved\") hook for adding your own actions after plugin settings are saved.\n\n### 0.1\n- Initial version.\n\nUsage\n-----\n\nHere are the basic functions available to you within your plugin.\n\n### add_setting($option_name, $value)\n\nThis is essentially a wrapper for `update_setting` that respectfully does not make any changes if the option in question is already set.\n\nYou'll most frequently use this in your activation hook.\n\n### delete_setting($option_name)\n\nRemoves setting.\n\n### get_setting($option_name, $type)\n\nRetrieves a specific option.  Returns string by default.  If you specify `array` as `$type`, it will treat the value as a delimited string (default semi-colon) and return an array.  \n\n### update_setting($option_name, $new_value)\n\nUpdates a specific option.\n\n### get_field_name($option_name, $type)\n\nGets an HTML field name.  If you set `$type` to array, the field value will be treated as a delimited string (default semi-colon) and stored as an array.  \n\n### the_nonce()\n\nCall `$YourPluginInstance-\u003ethe_nonce()` somewhere in your admin form to generate the nonce used to validate / save settings.\n\n### save_settings()\n\nThere is no need to call this unless you want to override the default functionality.  This function will be called on `admin_init` and automagically saves settings, if the right nonce and `$_REQUEST` is set.\n\n### Settings Object\n\nOne of my goals in building this framework was to have an easily accessible settings object that can be used directly when the getters / setters are inconvenient.  This is done by simply using `$this-\u003esettings[$option_name]`.\n\nObviously this should be used in read-only applications.  Setting values here will not update them in the database.\n\n\nFeedback\n--------\n\nI'm in no way claiming to have the perfect, final answer to managing options in WordPress themes or plugins.  \n\nThe goal of this minimalist approach is that you can simply build your plugin rather than contorting it to work with more demanding APIs.\n\nIf you have any ideas for how I can improve on what I have here, please let me know!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobjectivco%2Fwordpress-simple-settings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobjectivco%2Fwordpress-simple-settings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobjectivco%2Fwordpress-simple-settings/lists"}