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
- How to reorder billing fields in WooCommerce Checkout template? [closed]
- How to add a custom CSS class to core blocks in Gutenberg editor?
- Filter translations (gettext strings) on specific admin pages
- Filter hook before create order WooCommerce
- How to auto-translate custom user roles?
- add_filter for specific pages
- How to add attribute to output with wp_video_shortcode add_filter
- Change default settings used by gallery shortcode
- PHP5, Inheritance, Singleton – action & filter hook limitations
- Please explain me what the do_action does
- Add ‘if exists’ to filter
- How to check if “media_send_to_editor” is audio?
- Changing Order of Filters
- Please help me through this example with a filter to understand how they work
- Filter custom post types in archive
- How can I filter block registration based on post-type? (Block alignment settings)
- wp_insert_post_data filter not working correctly after upgrade to WordPress 5
- Yoast SEO hooks overriding themselves
- Passing variable from child theme to parent theme
- Removing an action, or dequeueing style – Both not working
- De-bloating the page classes
- Move a file from a directory to another
- Redirect to checkout woocommerce failed
- Filter the regular price of woocommerce products
- remove action from AMP plugin
- Correct way to filter get_pages() function
- wp_insert_post_data filter hook identify current action
- Add Class to a div using a filter?
- Shortcodes — Using add_action, add_filter in the shortcode
- How to link the whole list item in Gutenberg’s latest posts block?
- views_edit-post filter not working (custom post type)
- Upload file if contains certain name
- Filters/Bulk Actions return wrong URL in admin dashboard
- I want to allow the use of a data-flw attribute in links in comments
- How to know what filter to use and how to use it?
- Give “Read More” precedence over excerpt() word count
- What hooks to hook onto for automatic cache clearing
- Add filter to get_posts
- How can I output all apply_filters and do_action?
- Override has_post_thumbnail function
- WordPress add script with custom type (x-jquery-tmpl)
- Woocomemrce order and registration fileds to UPPERCASE
- Change login CSS
- How to redirect non-logged in users to login with post_password_required()
- How to add nonce tag to inline script for CSP
- Filter content for get_the_content()
- How to override include_once pointed file using add_filter?
- How to strip out javascript in wp_posts `post_content`
- Register new user, assign custom role then send email
- pre_get_posts to hide everywhere posts from “Archive” category
- What is the action or filter for adding information under the Permalink in Edit Post/Page?
- add after content don’t work
- Adding a filter to related posts not working
- need correction with a snippet in functions.php [closed]
- Can / should a widget plugin define its own Widget Area?
- conditional search
- output custom Posts on a Page
- Sql query does not work well
- WordPress Gutenberg core/heading block (wp-block-heading)
- Why does wp_die() not work when inside a namespace?
- Apply pre_get_posts filter in a certain moment (just for a particular block of posts)
- Set post featured image to author image
- How to Change the WordPress Locale with the ‘locale’ Filter?
- meta box loop problem with a search filter
- Modify Default URL for /wp-includes/js/wp-emoji.js?ver=4.6.1
- Is it possible to include the add_filter() function within a shortcode function
- Pass widget variable to external function
- Activate short codes for all post queries?
- Save something to global var in add_filter
- filter on the_content stopped working when I updated to WP 3.6.1
- Replace Paid Shipping Method With Free Shipping Method WooCommerce [duplicate]
- Wrapping Featured Image on Add/Edit Page in div?
- Clean/filter HTML inserted to post content by XML RPC
- how to localize the number of wordpress post views?
- Is it possible to make get variable out of filter in Class?
- How to elect position of new item output in a dropdown when using add_filter
- Query Multiple Filters, one with Meta
- How to remove a filter that is an object method?