{"id":218864,"date":"2025-02-04T13:03:27","date_gmt":"2025-02-04T13:03:27","guid":{"rendered":"https:\/\/en-gb.wordpress.org\/plugins\/switcheroo\/"},"modified":"2025-03-12T12:29:43","modified_gmt":"2025-03-12T12:29:43","slug":"switcheroo","status":"publish","type":"plugin","link":"https:\/\/pcd.wordpress.org\/plugins\/switcheroo\/","author":20727641,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.0.2","stable_tag":"1.0.2","tested":"6.7.5","requires":"5.0","requires_php":"8.0","requires_plugins":null,"header_name":"Switcheroo","header_author":"John Thompson","header_description":"Switcheroo makes managing feature flags in WordPress easy, fun, and powerful. Whether you\u2019re running a single-site or a multisite network, Switcheroo lets you toggle features on and off effortlessly, enabling you to test new functionality, control feature rollouts, and safely experiment without breaking your site.","assets_banners_color":"777076","last_updated":"2025-03-12 12:29:43","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/ufmedia.co.uk","header_author_uri":"https:\/\/ufmedia.co.uk\/","rating":0,"author_block_rating":0,"active_installs":0,"downloads":1696,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.0.1":{"tag":"1.0.1","author":"ufmedia","date":"2025-02-04 15:21:26"},"1.0.2":{"tag":"1.0.2","author":"ufmedia","date":"2025-03-12 12:29:43"}},"upgrade_notice":[],"ratings":[],"assets_icons":{"icon-256x256.png":{"filename":"icon-256x256.png","revision":3234738,"resolution":"256x256","location":"assets","locale":""}},"assets_banners":{"banner-772x250.png":{"filename":"banner-772x250.png","revision":3234776,"resolution":"772x250","location":"assets","locale":""}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.1","1.0.2"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[734,163165,174442],"plugin_category":[],"plugin_contributors":[237855],"plugin_business_model":[],"class_list":["post-218864","plugin","type-plugin","status-publish","hentry","plugin_tags-development","plugin_tags-feature-flags","plugin_tags-site-management","plugin_contributors-ufmedia","plugin_committers-ufmedia"],"banners":{"banner":"https:\/\/ps.w.org\/switcheroo\/assets\/banner-772x250.png?rev=3234776","banner_2x":false,"banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/switcheroo\/assets\/icon-256x256.png?rev=3234738","icon_2x":"https:\/\/ps.w.org\/switcheroo\/assets\/icon-256x256.png?rev=3234738","generated":false},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Feature flags are a powerful tool for controlling the availability of features on your site. By enabling or disabling flags, you can control what is active on your site without needing to deploy new code.<\/p>\n\n<p>Features are defined in the <code>switcheroo.json<\/code> file located in the root of your project. \nEach feature has:<\/p>\n\n<ul>\n<li><strong>Unique ID<\/strong>: An identifier for the feature.<\/li>\n<li><strong>Title<\/strong>: A human-readable name.<\/li>\n<li><strong>Description<\/strong>: Explains the feature's purpose.<\/li>\n<li><strong>Status<\/strong>: Indicates whether the feature is active, experimental, deprecated, etc.<\/li>\n<li><strong>Link<\/strong>: An optional link to further information.<\/li>\n<\/ul>\n\n<p>You can toggle each feature within the Switcheroo Settings in the WP Admin (Settings -&gt; Switcheroo).<\/p>\n\n<h3>Usage<\/h3>\n\n<h3>Managing Feature Flags in Code<\/h3>\n\n<p>You can wrap your feature-specific code in a conditional statement to check if a flag is enabled.<\/p>\n\n<p>For example, use the <code>switcheroo_flag_status('my_feature')<\/code> function to determine whether a feature is active and include its logic conditionally.<\/p>\n\n<h3>Suggested Feature Flag Statuses<\/h3>\n\n<p>Each feature flag can be assigned a status, allowing for better organisation and understanding of the feature's state:<\/p>\n\n<ul>\n<li><strong>Draft<\/strong>: The feature is still in development and not ready for use.<\/li>\n<li><strong>Experimental<\/strong>: The feature is available for testing but may have known issues.<\/li>\n<li><strong>Active<\/strong>: The feature is live and functional on the site.<\/li>\n<li><strong>Deprecated<\/strong>: The feature is being phased out and may be removed in the future.<\/li>\n<li><strong>Breaking<\/strong>: The feature introduces significant changes; enabling or disabling it may cause issues.<\/li>\n<li><strong>Archived<\/strong>: The feature has been permanently removed or is no longer supported.<\/li>\n<li><strong>High-Risk<\/strong>: The feature introduces significant changes or is under scrutiny for potential issues.<\/li>\n<\/ul>\n\n<h3>Command Line Management<\/h3>\n\n<p>You can also manage your feature flags via the command line using WP-CLI. The <code>wp switcheroo<\/code> command allows you to view and modify feature flags.<\/p>\n\n<p>Examples:\n- <code>wp switcheroo<\/code>: List all flags and their statuses.\n- <code>wp switcheroo my_feature<\/code>: Check the status of the <code>my_feature<\/code> flag.\n- <code>wp switcheroo my_feature on<\/code>: Enable the <code>my_feature<\/code> flag.\n- <code>wp switcheroo my_feature off<\/code>: Disable the <code>my_feature<\/code> flag.<\/p>\n\n<!--section=installation-->\n<h3>Plugin Directory<\/h3>\n\n<ol>\n<li>Search for \"Switcheroo\" within the Add New section of your WordPress plugins page.<\/li>\n<li>Configure feature flags in the <code>switcheroo.json<\/code> file located in your project root, wp-content folder or active theme folder. You can find an example of this file in the root folder of this plugin.<\/li>\n<li>Use the settings screen under <code>Settings -&gt; Switcheroo<\/code> to toggle features.<\/li>\n<\/ol>\n\n<h3>Manual Installation<\/h3>\n\n<ol>\n<li>Download the latest version of the Switcheroo plugin from Github: https:\/\/github.com\/ufmedia\/switcheroo\/releases\/latest<\/li>\n<li>Unzip and upload the <code>switcheroo<\/code> folder to the <code>\/wp-content\/plugins\/<\/code> directory.<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress.<\/li>\n<li>Configure feature flags in the <code>switcheroo.json<\/code> file located in your project root, wp-content folder or active theme folder. You can find an example of this file in the root folder of this plugin.<\/li>\n<li>Use the settings screen under <code>Settings -&gt; Switcheroo<\/code> to toggle features.<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt id='what%20is%20a%20feature%20flag%3F'><h3>What is a feature flag?<\/h3><\/dt>\n<dd><p>A feature flag is a toggle that allows you to enable or disable specific functionality on your site without deploying new code.<\/p><\/dd>\n<dt id='where%20do%20i%20define%20my%20feature%20flags%3F'><h3>Where do I define my feature flags?<\/h3><\/dt>\n<dd><p>Feature flags are defined in the <code>switcheroo.json<\/code> file, located in the root of your project.<\/p><\/dd>\n<dt id='can%20i%20manage%20feature%20flags%20from%20the%20command%20line%3F'><h3>Can I manage feature flags from the command line?<\/h3><\/dt>\n<dd><p>Yes, using WP-CLI commands such as <code>wp switcheroo<\/code> to list, enable, or disable flags.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.0.2<\/h4>\n\n<ul>\n<li>switcheroo.json can now be placed in the root, wp-content or active theme folder.<\/li>\n<\/ul>\n\n<h4>1.0.1<\/h4>\n\n<ul>\n<li>Updated ahead of directory publication.<\/li>\n<\/ul>\n\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>Initial release.<\/li>\n<\/ul>","raw_excerpt":"Easily manage feature flags to control the availability of features on your WordPress site without deploying new code.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/218864","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=218864"}],"author":[{"embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/ufmedia"}],"wp:attachment":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=218864"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=218864"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=218864"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=218864"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=218864"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=218864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}