It seems the problem lies within redefining a widget: a widget with the ID “recent-posts” already exists, and that’s causing some strange behaviour when saving the widget. This is possibly due the callback on saving the widget being on the original widget class WP_Widget_Recent_Posts
).
It’s not really a good idea anyway to redefine a widget; the widgets API is not intended to be used that way. Your problem can be fixed by using a unique widget ID; replace ‘recent-posts’ by another ID in
parent::__construct('recent-posts', __('Recent Posts'), $widget_ops);
And while you’re at it, rename the widget to avoid having duplicate widget titles:
parent::__construct( 'myplugin-recent-posts', __( 'My plugin: Recent Posts', 'myplugin_textdomain' ), $widget_ops );
Related Posts:
- Best practices regarding the creation of custom widgets?
- Using add_filter() in Widgets
- Dynamically Register Sidebars For Each Top Level Page
- add sidebar area to header of child theme
- Missing argument 2 for a custom function widgets_init
- How would go about if I just want a temporary function?
- How to insert custom widget in custom sidebar in theme activation?
- Right way to update widget on dynamic new input field
- How do you Permanently Delete Sidebars
- Custom Sidebar only on single post
- login_headertitle is deprecated since version 5.2.0
- Why is it so hard to add a class to the tag in the sidebar widget?
- Register_Sidebar overwriting itself and doesn’t exist in global $wp_registered_sidebars;
- How to echo Widget Title in Custom Frontend-Template Box
- Save_post – Warning: Cannot modify header information
- Modifying a WordPress Plugin
- How do you insert code into the sidebar?
- Extend WordPress Audio Widget to accept HLS (.m3u8) URLs
- Adding A New Widget to WordPress Disables the Existing Widgets
- How to programmatically GET (to know) which Sidebar (or) which Menu is being used on Different Pages?
- Add the title of a widget as an ID – for anchor links
- Remove Actions/Filters added via Anonymous Functions
- Check if post is being published for the first time, or is an already published post being updated
- Display random categories on the front page (Finding and Editing Theme Functions)
- How to influence the information displayed on widget inside wp-admin
- WordPress Theme Update Action?
- How can I get $id variable in widget’s form function?
- Using a private method as an action callback from within a class
- opening links in new tab using – add_filter( ‘the_content’, ‘make_clickable’);
- remove the wrapping of text widget or
- Check if has any sidebar active on current page
- Set default options for inserting media
- Authors details such as social media links, emails etc → Is this Meta or something else?
- How to hook into the quick edit action?
- Default or Preset Content for Custom Post Types
- Remove tag on my RSS Feed
- WooCommerce add_action hook results in 500 error
- Advice: Template structure – php blocks in sidebar or someting else?
- Delete pages and Create default pages for all new network sites
- Actions according to image type and size
- Post thumbnail relative link and HTML modify
- Remove the deleted users avatar from list
- How to call custom function from functions.php in site-wide template files?
- Pass parameters to function through an action
- Accepted arguments value in hook functions
- Which action hook to use for function?
- str_replace function in theme
- Custom HTML in specific category single page and its descendant categories
- Modify a function without editing template
- Don’t delete a page if it holds users
- Override widget in function WordPress
- Twentyten Child Theme: header images display messed up in admin panel
- Is there an alternative to get_template_directory_uri()?
- Word Press – Dynamic Content [closed]
- Insert image in WordPress with HTML5 tag and caption function
- how can I just add to parent theme function(s) instead of redeclaring whole the function
- Reuse variable in hook callback
- Modify custom field input data before creating a new post
- Choose sidebars column in widgets.php page [closed]
- Custom taxonomy widget in admin area
- Skeleton Child Theme Add Icon Bar to Header Flex Grid
- Dashboard widget custom positioning?
- register_sidebar_widget is deprecated since version 2.8! Use wp_register_sidebar_widget() instead
- I can’t seem to install Font Awesome locally [closed]
- Plugin Development – Functions or Hooks?
- Custom HTML markup
- Use a shortcode to display custom meta box contents
- problem loading stylesheets to wp_head dynamically
- How to properly refresh page after form action?
- Create a Woocommerce product widget with category filter
- Best way to disable sidebars on posts (only)?
- Insert Content Before div#main from the functions.php File
- How to append custom text to the output of ‘categories widget’?
- Problem in using Customizer
- Linking Javascript in functions.php file
- How to conditionally add a widget via a hook in functions.php
- Creating a custom wordpress widget and stopping js from running twice(once in active widget once in widget selector)?
- How Do I include/Import a Custom Widget from the Parent theme into My Child Theme?
- Multiple, Dynamic, Sidebars Problem – First Sidebar not working properly
- Include widget file in functions.php of child theme
- How to replace ACTION url from original wordpress login form?
- How do I trigger WP CLI DB export using a PHP function?
- External api call and make global variable for any page visitor enters , page-home, page, single etc
- CSS style and app.js not loading
- Parent category as WOOCommerce Categories widget title
- How would I correctly implement a new if statement in a child functions file?
- True email confirmation for registration (keeping unvalidated users from user table)
- How To Show Shortcodes In WordPress Custom Fields?
- Fatal error: Call to undefined function add_action() – an untouched problem
- What add_action reference should I be using or should I use do_action?
- unregister_sidebar in child theme not working
- Get Value of Custom Field
- restrict access to specific urls on a specific period of time
- How to request login for user but not for bots
- function to return comma separated list of meta values
- How do I add functionality to images?
- WordPress Custom wp mail template return full template
- How to create a post without link in wordpress?
- post_row_actions filter from parent theme not executing in child theme
- How to get variable from other function inside class function using add_action for Ajax call