The <input>
generated by your client_id_field()
function is using the wrong name
which is pardot_client_id
, and by “wrong”, I mean there’s no database option registered with that name and the one you’ve registered is named pardot_settings
.
-
The database option is the second parameter for
register_setting()
. -
And it should be used in the
name
attribute of form fields like<input>
and<select>
, e.g.<input name="DATABASE OPTION NAME">
.
So looking at your class, you should have used <input type="text" size="30" id="pardot_client_id" name="{$html_name}" value="{$client_id}" />
there.
And then get the saved option like so:
// Get all settings in the option array.
$options = (array) get_option( self::$option_group );
// Get the pardot_client_id setting.
$client_id = $options['pardot_client_id'] ?? '';
Related Posts:
- How can I save a multiple select array with the settings API for a plug-in options page?
- How can one utilize a variable as a callback function name for add_settings_field
- How to get bool with `get_option()` when already registered setting with type `boolean`
- Why can’t I use “%s” format value in the WordPress function checked?
- Settings API – sanitize_callback is not called and it leads to an incorrect behavior
- Why use the Settings API over a new administration menu?
- Implement toggle switch for theme options in settings API
- Set the checkbox as checked by default at options page
- Fatal Error relating to sessions.php
- Whitelisting items from custom options page
- Settings API callback function inserts html quotes from nowhere
- Uploading files using the Settings API
- Get URL Parameters from referer
- Saving plugin settings – ERROR: options page not found
- Get categories names as an array to use it in theme settings
- how to save checkbox data for custom setting?
- register_setting & add_settings_error validation issues with multiple fields
- Reading settings in the home page precisely home.php
- Cloning add_settings_field() with jQuery
- Settings API form – submit with AJAX
- Custom plugin: how do I call a PHP file if settings option is set to true?
- register_setting not save checkbox
- How to call a WP Class inside my theme
- image on homepage disappeared due to change of permalink name
- WordPress Setting API – There is no field in options.php
- Undefined index notice when using the $args parameter in add_settings_field()
- Custom query to get post names beginning with a digit
- Custom Yoast Breadcrumbs URL
- Real time Duplicate title check
- How to check from which page the user is coming to the current page?
- Insert code when users come from an specific referer
- CSS saved & enqueued, but wordpress doesn’t load css text, only file
- Execute only on a certain page
- Add a Custom Class to Admin Menus
- Type hinting and void return question
- Replace comment avatars and links at the same time
- How to display recent posts on home page with custom HTML
- How do I add text in a shortcode?
- How to display php source code inside a post using visual editor?
- Stumped – Ajax Response Returns 0
- Upload Image in a WordPress page using PHP
- Get Custom URL For Custom Taxonomy
- Show full posts in archive
- I want to select the from values from database in WordPress? [closed]
- Error in custom php function doesn’t exist
- How can I hide that I Use WordPress (with W3 Total Cache)
- Can anyone offer any help with this function?
- Changing the_posts_navigation() html output
- User register hook is not working in woocomerce register form
- Show meta box only for default page template
- Display related posts without a plugin
- load ajax using admin-ajax.php
- Create a WordPress shortcode using PHP [duplicate]
- How can i count the post added in relationship field, theme display
- Custom meta box values are not getting saved for my custom post type
- locale filter function running multiple times
- How do I get the content excerpt of the recent post?
- Save Custom CSS file in the upload folder dynamically?
- How to include custom PHP file both in header and footer files
- Send notification email to admin for every new post published
- Retrieve Json data and create multiple pages with it
- Get css class of menu item in custom menu structure
- How to check if a category has a parent and child categories?
- Meta boxes only displayed when editing normal (default wp post_type) posts
- Accessing Global Vars & Functions in custom php page
- Display latest post from WordPress Featured Category that is also in X,Y,or Z categories
- Limit ‘contributers’ abilities in WordPress
- Load Javascript for a widget WordPress
- WordPress 6.0 class-wp-widget.php fatal errors in PHP 8.1.6
- Unserialize Custom Field & Save as Multiple Rows in WordPress Database
- Add a product category to a specific product via a button
- Add class to image in php
- Creating a checklist with ACF and I cannot figure out how to add all iterations to an array that I’m creating
- How does one make a URL return dynamic JSON with custom Content Type?
- custom-header not working
- Need to forward Data from WooCommerce Webhook sent to same site WordPress REST API custom endpoint
- Add Product Permalink in woocommerce admin order page
- Proper use of Output Buffer for a whole php clas
- How do I make comment-reply-button with that takes to comment reply form on click
- Allow user to choose header style
- Require advice handling a URL redirect from a Third Party. URL Params need to populate and then forward to payment
- missing admin bar and widget in a template
- ERR_TOO_MANY_REDIRECTS / To Force SSL Logins and SSL Admin Access
- My own theme’s custom widget areas are not working
- Not able to add new item in wordpress home page
- How to apply filter
- Allow BBPress participant role to trash topics
- How to find the function which is outputting Array
- Manipulate database of WordPress site with my own scripts
- How can I include a file related to blog URL? Nothing seems to work
- How Can I Center the Logo in the Navigation Menu? [closed]
- Where are Sessions are being started? [closed]
- Get the current page in a call back function
- PHP Use Declared array Variable inside already Declared Array
- How to create and add js and css file when server is not on my PC?
- Object of class WP_Post could not be converted to string while trying to console.log wp_get_nav_menu_items
- Check radio get value to array
- Your PHP installation appears to be missing the MySQL … After deleting and restarting from cpanel
- Understanding responsive imagery
- How to get meta box labels?