Yep you can use add_settings()
to create the setting itself. There is an example in the codex.
This example code could go in your themes functions.php
file or in a plugin file, it’s up to you.
Then in the header template all you would have to do is use an if
statement to check what the value of the aforementioned setting was and either output the JS
link or not based upon this variable.
Related Posts:
- Is there a reliable way to keep track of how long a WordPress theme has been active?
- Add Plugin options as subpage to Theme options page
- Upgrade 4.5.2 to 4.5.3 deleting row in wp_options table
- ‘Global’ settings page for multisite plugin
- How to add field for new site-wide option on Network Settings screen?
- Contact form 7 select box different value-text than content-text in option [closed]
- Modifying a JS file with data from plugin settings
- Correct way to serialize the data of options table?
- Where should I use get_option in a plugin
- Inherit plugin settings to new site in Multisite
- How to tell if plugin has been network activated
- Is there a hook attached to general settings save?
- How to find out if option exists but is empty?
- How should I use register_setting, add_settings_section, & add_settings_field in my plugin’s options page?
- How to access options of Redux framework in front end
- Custom plugin settings: clicking “save changes” does not display success message
- Duplicate settings of master blog to slave blogs in WP multi-site installation
- Environment Specific Options Token
- How do I extract the Alt Text from an image attachment upload via the WordPress Options Framework Plugin?
- Network-Wide Plugin Settings Management
- How to create a Page alias in WordPress
- How to fetch serialized data from wordpress options
- Add custom meta box on Post page
- Some Plugin Settings Are Kept After Removal and Reinstall of the Plugin
- Changing widget options via the functions.php when there are no hooks
- While Using Static Pages, How Can I Get /blog into the URL of Each Post?
- Get all options saved by another plugin
- How to load default scripts included with WordPress correctly?
- Is it ok to call get_option without hooks?
- Enable/Disable WP options programmatically
- Custom options page checkbox will not save, despite working with text
- Add a Custom Permalink option in the Permalink Admin Screen?
- Settings API – input always updates over validation
- add function to saving change on Options Pages
- WooCommerce “Save Changes” button appears inside custom settings
- clean wp_options table unused rows
- How to set CORS header?
- WordPress site migration addvice
- Prepare plugin options for multi-lingual support
- Remove obsolete plugins artifacts from database tables
- Restore a Plugin’s Default Settings
- add action wp_head not working
- How to debug register_setting callback function
- Why is the Settings API is not saving my array of options
- Creating a plugin that will add options. Where should the options menu pages go?
- Add get_option to jquery
- update_user_meta add value on the top on existing value
- Can’t get plugin settings page to save data
- Default Plugin Settings Not Writing to Database
- Update Option Error: Notice: Undefined index
- How do i save plugin-specific info?
- Set the active Navigation Menu from a plugin
- Serialize data for wp options
- How can I add an options page for my class based plugin?
- problems with wordpress and php version 5.3.3-1
- Why slash is removed after domain?
- Where does WordPress store plugin (enabled/disabled) status for multisite?
- How to add a default value to get_option if it’s used as a variable?
- Redux Framework has an embedded demo. Click here to activate the sample config file
- WordPress get_option and update_option returned entered on the textbox field
- Get plugin option in another PHP file
- Create mobile navigation header with settings integration
- Media upload not working on theme option in WordPress 3.8.1
- Image upload and other options in the same plugin settings form?
- Admin Theme customization
- How to get specific setting by settings_fields()?
- There is any way to remove post-format filter? [closed]
- changes to widget settings not showing up in individual pages pages until they’re updated [closed]
- Show admin notice on incorrect value on form field
- How to remove traces from widget during uninstallation
- php page not found for plugin options menu
- add tabs in rdp-plugin/includes/settings.php and get settings saved
- Enabling plugin failed because MySQL user do not have CREATE permissions
- wp_editor content in plugin options page
- Getting Theme element into plugins page editor in wp admin
- options creation for plugins
- How to create an option page for this simple plugin
- Redirect to another page using contact form 7? [closed]
- get_option error plugin development
- Gathering and logging data from a plugin: how to do it without race conditions?
- Elementor: How to override global theme style settings? [closed]
- Is there a way to get plugins and themes not built for multisite to work on a network subsite?
- Update a core option from plugin settings page
- WordPress error: Options page Setting_ not found in the allowed options list
- Can I use register_settings and unregister_setting once the settings page has loaded?
- update_option_{$option} not showing old value
- Updating options into the wp database performance
- Can deactivating a plugin sometimes “reset” settings within that plugin?
- Allowed memory size exhausted problem
- Change the style of h1, h2, only in post entry
- Plugin getting Cannot modify header information errors
- How to add options to the plugin page?
- Saving widget options from class method
- How to prevent plugins from sniffing/stealing other plugins’ options?
- Default plugin config to override wp_options?
- get_option / wp_localize_script Not Working in OOP Plug In
- OceanWP settings are missing from Add New Post [closed]
- Change in one place the data about the company, which are placed on several pages
- Plugin scheduled event not working
- Update WP option by plugin