You don’t pass more than argument to that filter, so any callback expecting more than one will not get it. The core calls this filter always like this:
$title = apply_filters(
'widget_title',
empty($instance['title']) ? '' : $instance['title'],
$instance,
$this->id_base
);
But you are passing just $instance['title']. Add the missing parameters, and the error will vanish.
If you cannot change the widget, change the registration for the callback for the filter, and make the other arguments optional by setting a default value:
add_filter( 'widget_title', 'my_widget_title_filter', 10, 3 );
function my_widget_title_filter( $title, $instance = [], $id_base="" ) {
if ( '' === $id_base )
return $title;
// do something with the title, then
return $title;
}
Related Posts:
- How can I modify the WordPress default widget output?
- How to hook into unregistering a widget instance?
- Filter Widget Title Wrap
- Is it possible to remove the filter from 4.8 text widget?
- Anyway to edit the titlebar of WordPress Widgets in the Admin area?
- WordPress tag cloud add more links
- How to add a class to Tag cloud widget link?
- How to make a widget expand wider than the column width when editing its settings in the admin
- Add Bootstrap Classes to Recent Posts Widget
- include specific Pages to wp_list_pages with filter
- Shortcodes within the sidebar text/html widget: How to preserve the raw HTML output of the shortcode?
- I’ve set up an extra field for all the available widgets. How do I show it’s value in the front-end?
- Archive Widget – Count only parent posts
- Widget image reorganize layout
- How can I change the button text of a custom widget?
- WordPress Tag Cloud Filter Prevents Widget HTML from loading
- How can I add a prefix to titles displayed in sidebar using function.php?
- Filter WordPress Archive Widget to exclude posts with specific custom taxonomy term id
- Output dynamic_sidebar_params in wp_head
- Filter on widget-title does not work with custom links
- How to use apply_filters(‘get_calendar’) to change get_calendar() output?
- Filter widget_pages_args not working in Pages Widget
- Woocommerce price filter widget always shows max price of most expensive product in the whole shop
- Insert HTML just after tag
- the_content and is_main_query
- How to pass/get data to/from the WooCommerce data-product_variations object?
- Add whitespace between Chinese and other letters
- Translating an error message
- Display WooCommerce newest product reviews on top [closed]
- Overriding wp_get_archives() apply_filters()
- How to make post and comment count unclickable with dashboard_glance_items hook
- Call to undefined function error after adding add_filter to wp-config
- How can I hide all posts that don’t have a thumbnail?
- Add Dropdown menu using “add_filter => wp_nav_menu_items”
- Filtering ‘the_title’ with option to return subhead?
- Restrict filter to run only inside specific function
- How to add a custom filter in functions.php
- How apply_filters work in WordPress?
- What functions are included in apply_filter(‘the_content’)
- Filtering admin entries for custom post type
- Are there Limitations on filter handles?
- Hide content editor for posts after approriate date
- Buddypress: Edit activity when new blog post [closed]
- How to make a button?
- Same Conditionals Not Working on Two Different Hooks
- check to see if hook is available
- Use add_filter on concatenated string variable
- Filter users by custom colum not meta key
- How to allow users to view pending posts of a specific custom post type?
- Remove filter callback: method in class
- How to filter meta_values using REST API
- How do I use remove_action on an add_action that uses an array?
- Admin Backend – Search Pages only by title
- How to hide Ads in between posts on AMP? [closed]
- Change the default 10-day expiration for the password protected pages cookie
- Add content as soon starts
- Access get_the_title() from ‘excerpt_length’ filter
- Wrong post_status notice after wp_insert_post_data
- BBPress changing default group activity
- Comment search plugin
- add img class to native wordpress galleries
- Get Posts updated or published within the last x hours
- Missing Argument 2 for apply_filter
- How to get a single hook from wp_head()?
- WP filter to alter admin CSS styles?
- preview_post_link for Custom Post Types
- Why this filter hook is not working when passing parameters?
- Is it possible to bind a function to a filter hook via Ajax?
- Change the template when the user is not logged in using page_template filter (it does not work)
- Regarding post text filtering
- Add Filter not working with get_posts
- How to Prevent WordPress to encode html in post?
- Filter posts by meta data using custom query
- Which Filter Do I Use To Modify The Subject Of The Retrieve Password Notification Email?
- Register users by e-mail
- automatic title through filter
- Filter causing loss of _wp_attachment_metadata
- Action hook to control access to certain parts of my site
- Buddypress Filter Multiple Activities [closed]
- How can I tranlslate post date in italian?
- Use alternative front page if cookie is set
- Having wp-admin on different domain
- Use a functions in functions.php to remove a string for template theme
- how to output HTML tags in post_content and not as plain text
- oembed_dataparse filter not running at all for standard YouTube embed
- Add filter conditionally to a page
- mu-plugins body_class filter not working
- shortcode function outputs multiple anchor tags
- Show child theme for users on specific IP
- Remove action added from class
- wp.getPosts with status = ‘trash’ using node.js
- Adding an orderby filter, casting postmeta with multiple keys
- Identify admin/logout and more filters
- Sanitizing a custom query’s clauses
- How to create a list of terms who’s posts also have a predefined external term?
- How to change this WP logo and posts url in block editor?
- Limit total tags in the_content
- Change or replace user_profile_picture_description filter, to stop stripping whitespace
- How to add custom field to top of WordPress Comment Form for both logged in and anon users
- Insert selection from filter everything pro into gravity forms field