Crude code. I have never tried this but I can get you part of the way there.
Add a field…
add_action(
'in_widget_form',
function ($instance) {
echo '<input type="text" value="c00l" />';
return null;
},
1
);
And there is a hook that runs on settings update.
add_filter(
'widget_update_callback',
function($instance, $new_instance, $old_instance, $this) {
var_dump($instance, $new_instance, $old_instance, $this); die;
},
1,4
);
However, it looks like you need to add an option/setting to the widget before that hook will work and I don’t see how to do that. I am probably missing something obvious but don’t have time to do more research right now.
Reference
http://core.trac.wordpress.org/browser/trunk/src/wp-includes/widgets.php
Related Posts:
- Individual Widgets per Page
- Having different sidebar content for MANY pages?
- Get custom field values into the sidebar/widget?
- Best way to allow manageable social media URLS?
- How do you create dynamic customised sections in WordPress?
- Creating a custom menu/widget area
- Creating a widget with a number of custom fields
- How to display image inside container of custom made widget
- Want to make A CSS if meta key value is empty
- how to display a widget only on a page where the custom field is defined?
- What’s the best way to implement custom widgets on a per post basis?
- Is there a way to dump all registered sidebar/widget?
- Display custom widget value in header.php
- Custom field outside the loop and inside an array
- WP_query returns error when used for custom widget
- Add class from custom field into widget class
- Running a Gallery Shortcode in a Custom Fields Widget
- I would like to display different text on different pages
- How to check if custom field exists in this widget query
- Add fields to edit in custom widget
- Is there a way to set default custom fields when creating a post?
- So much data in postmeta
- Show only posts which can be commented OR have custom meta field
- Need small coding with Custom Fields Search
- Show Custom Comment Fields when editing in admin
- How do I make a custom field choose an image?
- get_post_meta() unserialize issue – returns boolean(false)
- How can I remove fields in the attachment editor?
- Edit Custom Database Tables in WordPress
- How to store the value of a custom field dropdown select for post referencing?
- Gutenberg Custom Block
- Up/Down voting system for WordPress
- Custom Meta Field not Working with qTranslate [closed]
- Change content before writing to database
- post meta data clearing on autosave
- WordPress Search Custom Meta Field Only
- Problem in custom meta boxes
- Loop through two different sets of custom fields
- Query Problem – Show posts within category ‘x’ that have a custom field between ‘y’ and ‘z’
- Add description text under input field for new profile fields
- Which is best in the following scenario : post_meta vs custom table vs parent/child posts
- How to add content at the end of posts?
- sort search results by custom fields using dropdown
- WP Custom Fields Metabox Disappears – ACF plugin issue [closed]
- Get all posts that do not have a specific custom field without using a subquery
- How to query posts with certain custom meta data, and output Post data
- Custom Fields Not in Search Results
- How to loop through certain custom field values
- add_action and remove_action if custom field exists
- wordpress custom fields multiple data
- Store array as single, serialized post meta field or many post meta fields?
- Get an advanced custom field after post publish
- Why the pagination for a query modified by pre_get_posts doesn’t mind the number & order of posts sorted & selected based on a custom date time field
- update_post_meta for repeated custom field [closed]
- Trying to update_post_meta function
- How do i add custom fields to my themes template file?
- Custom Field to a Role?
- Delete custom fields when deleting posts
- Pull custom fields from custom posts within a loop
- Ordering posts by custom field named “date” in backend
- How to pass page as an argument like post in WordPress?
- How to display custom fields from a plugin
- Adding “meta” info to WP site PHP function?
- WordPress Media Uploader custom Javascript not working
- Custom fields issue [closed]
- Select custom posts by meta_value and sort by a different meta value
- List custom queried terms in the edit-tags.php?taxonomy page
- Display meta box dropdown (from custom post type) in the page post type
- Front end register with custom fields
- how can I show name and value of Custom Fields together?
- Adding simple (one button) Audio player using Custom Fields?
- Display custom field from the front page on another page
- No result update a custom field using wp_schedule_event
- Gravity Forms Update post meta from template [closed]
- Custom wpdb query – how to sort post by another table meta_count
- Custom Field & Gravity Forms [closed]
- Add a custom field to my custom post type and then get posts which are before the given date in the custom field
- Custom User Dashboard
- Custom Fields not working properly
- Custom meta POST request fired twice when updating a post in Gutenberg
- add meta box considers the selected option as post parent
- How do I display a custom field in an existing form on the front end?
- Saving and using Custom Field in user settings/profile “Checkbox list”
- Extend WP_User_Query or WP_User to return all custom fields?
- Quicktag button to automatically add a custom field to a post
- WordPress taxonomy child image
- Create custom fields/meta data gender+country – radiobuttons and dropdown on register screen for these fields
- Add nofollow to custom field link and make domain exceptions?
- Override edit_custom_walker.php to conditionally show input depending on menu position
- wordpress simple post multi rating with post_meta and user_meta
- Change event firing in wordpress
- Filter CPT based on meta box value using Flexible Posts widget?
- Download stuff after filling fields?
- Custom search with meta fields
- Use custom field value as href
- Custom registration form and custom field
- Custom field for image, not showing image!
- How can i put a custom field inside this php
- Conditional display based on ACF checkbox
- How to add an ACF only for parent term?