Here’s a slightly modified version of your code snippet:
add_action( 'login_head', [ 'WPSE_Admin', 'plugin_setup' ] );
class WPSE_Admin
{
public static function plugin_setup()
{
add_filter( 'login_headerurl', [ 'WPSE_Admin', 'the_logo_url' ] );
}
public function the_logo_url()
{
return get_bloginfo('url');
}
}
The filter callbacks must be public, not private. The reason for this is that apply_filters()/apply_filters_ref_array()
are running call_user_func_array()
on the stored filter callbacks, in the global $wp_filter
array.
Also notice that you’re not instantiating your WPSE_Admin
class, so you can’t use $this
. You might want to use namespace but I just prefix the class here.
Related Posts:
- Filter Hook callback error, is it due to using $this inside a filter or something else?
- Filter an array with a callback – for single & multidimensional arrays
- How To Override A WooCommerce AJAX Function
- Plugin default settings hook
- Add custom options to the wplink dialog
- How many filter/action hooks are healthy?
- Filter specific shortcode output?
- Insert new element to array with add_filter
- How to hook into unregistering a widget instance?
- How can I extend the Gutenberg table block transform to allow colspans/rowspans on pasted table elements?
- get_option() filtering and getting out of recursion
- Get excerpt from $post->post_content
- How can I add information underneath the user’s name on the users.php page?
- Is calling function_exists() faster or slower that apply_filters()
- Filtered query_vars becomes global. Why does this work?
- How can I filter Microsoft Word gunk from pasted content?
- How to disable all WordPress emails modularly and programatically?
- Allow Profile HTML for select users
- Alter only the page title, not the post titles within
- Load different template file when condition met?
- WordPress 3.5+ upload tool filter
- Search with filters and title
- Use content custom filter for all shortcodes
- Filter all html output
- How can override a add_filter of a plugin?
- Return array of images after content
- failed to filter hook `get_terms_defaults`
- Nested calls the the_content filter
- Filter list by a unique meta value dilemma
- How to use shortcode attribute in separate function
- Is it possible to track down Actions and Filters?
- How to filter a wordpress core function?
- Adding id and class to the search input in WordPress search form
- get_bookmarks filter not supplying query argument (wp 3.1)
- Filter and modify entry-footer link in twentyseventeen
- Filter Posts by current Month
- Are there actions or filters I can use for Ajax calls?
- Correct method of redirecting user login
- How to filter for user registration, be able to throw error message
- No ‘Access-Control-Allow-Origin’ header is present [closed]
- How to prepare WordPress Rest data for Preview Changes?
- Admin filter for product SKU?
- Contact Form 7: Make field required after checkbox is checked
- Customize title, description and focused keyword [closed]
- Filtering the post list in the admin area
- Filter pre_get_posts does not modify Mine/All/Pending
- wp_mail works with add_action(‘save_post’, …) but not an ajax action
- How to check if a protected hook is hooked?
- Can i use multiple ‘the_content’ filters?
- Is it possible to put the add-filter()-hook into a function?
- How can I return shortcode output to the top of the content?
- separate categories with comma and srounded by single quote
- Filter for when the post is updated
- term_link filter gives less atributes
- Filter a pluggable function
- Add mime types with plugin
- Filter media upload attachment meta
- Filter have_posts()/ the_post()
- Filter wp_redirect() to stop redirect under certain condition
- How to add filter in custom rss feed
- Echo string in admin panel footer beside version no
- How to change default text for specific post type
- Add PHP code after title in single post pages?
- Renaming wordpress login and get new password button
- Hook in a sidebar widget and add some markup
- preg_match() not working with post content
- Search a title word through query_posts (not the exact match)
- Parse a shortcode differently based on on what it’s nested in
- Elementor Image Hover + Filter Grid [closed]
- ‘manage_users_custom_column’ is a filter, but ‘manage_posts_custom_column’ is an action. Why?
- comment_notification_text filter not working
- Line Breaks are stripped off when direction property is found
- Scanning for custom embed and prefetching
- WordPress remove_filter not working
- How to exclude or include categories in wp rest API without query parameters?
- Remove and replace woocommerce add to cart button [closed]
- Hook to change the site URL
- Replace a specific URL on all apperances on the Website (Maybe a filter?)
- Strange behaviour of REGEX in a WordPress filter (trying to suppress emtpy paragraphs)
- Modify Contextual Help
- Widget image reorganize layout
- WordPress set featured image to first image of the post
- Modify WordPress search behaviour in backend?
- Re-order search results with posts_orderby filter and post meta value
- Auto-generated excerpt with shortcode and read more button/text link
- ‘the_content’ Filter delivers empty string with lengh (608)
- Testing requested query in pre_get_posts
- Output dynamic_sidebar_params in wp_head
- Converting restricted html in comments to bbcode
- What is the proper/best way to have multiple add_filter for wp-job-manager-resume
- Modify WooCommerce email shipping text value
- How to replace all images in all posts and pages with a different size?
- Using Filters To Change Page Title
- How to add a class to Buddypress avatars in the Activity stream? [closed]
- using posts_where for meta data on pre_get_posts
- can’t output gray scaled image I’ve created using add_image_size
- How properly write function to filter content in a template for plugin “multiple content blocks”
- Better way to change the default password reset url with the woocommerce one?
- woocommerce_coupon_is_valid_for_product not working to exclude specific product tag
- How can I conditionally add the filter option_home?