You didn’t specify how many arguments your function accepts when you used add_filter
:
add_filter( $tag, $function_to_add, $priority, $accepted_args );
Your code only passes a $tag
and a $function_to_add
, but it doesn’t tell WordPress what priority it should be, or how many accepted arguments your function takes. You need to fix that. If you don’t provide the 4th parameter, WordPress assumes your function only accepts 1 argument, even if you define 2 in your function ( $thumbnail
and $atts
).
Also, if the filter only provides a single argument, then WordPress can’t pull a second argument out of thin air
Related Posts:
- Best collection of code for your 'functions.php' file [closed]
- How to not allow users to create new tags, but allow to them to use existing ones
- How to include a plugin’s php file to another plugin functions file [duplicate]
- Limit access to posts/pages by user roles
- Remove Google Fonts Which Are (Probably) Added By Plugins
- if plugin is active? check if plugin is enabled or not?
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- How to override a theme function (within a class) using a plugin
- Editor access to plugin settings
- Seeking clarification on page request life-cycle
- How to assign user a role if none is present when logging in
- Shortcode display outside the div
- Custom Widget outputs the input but doesn’t save anything inside the textarea
- How to remove action from plugin?
- How to find out what blocks are added by a plugin
- Can wp_script_is used in pluginA check if a script is being enqueued/registered from pluginB?
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- plugin development: problem with functions
- Dropdown menu on custom page with product to choose number of products per page
- How to append to title via functions.php for auto-posting plugin [duplicate]
- Snippets: is it better to add them in functions.php or make site-specific plugins?
- Display post lists in 2nd paragraph
- How to display custom sidebar in wordpress 5.5.2
- creating html reusable blocks via shortcodes
- Replacing a plugin function with a custom renamed function doesn’t work
- Facebook Messager Plugin
- Fatal error: Call to undefined function cmsms_theme_page_layout_scheme()
- Disqus deleted comments are syncing with wordpress but active comments do not
- WordPress get_avatar function not correct working
- WordPress metaboxes – textfield suggestion automatically populated
- Which file of wordpress manage plugins functionalities?
- Improving the perfomance of a plugin action
- Check if variable is set in filter
- Image change on hover
- Passing stored variables to add_filter
- JQuery prepend a function
- Basics of changing plugin output
- How to make a dynamic css class whose name changes every visit to confuse scraper
- Activate and deactivate plugin automatically
- Send email with list of active plugins upon activation/deactivation
- Using custom fields for image alt and title
- Where Should i write the code for wordpress ajax voting?
- dynamic name of the style for wp_enqueue_style
- Set up functions to be overridden without using function_exists() by short-circuiting them?
- How do I convert my WordPress website to be domain agnostic?
- Add the_post_thumbnail_url to a shortcode in function.php
- Add action to custom Function
- Show media-uploads to all users
- Help with a function in a widget
- how can authors to define custom pages?
- Adding a Tag Parameter / Filter to My Shortcode
- Call javascript functions from each page
- Add_image_size not generating correct size
- How do I create pages within a WordPress post?
- How can i call a functions.php function, from inside my plugin class?
- How to make WooCommerce payment method field optional?
- How to upload large media file in chunks, without any plugin?
- WordPress Custom Hook with Class method
- WP Function does not trigger on Webhook API Call
- Why do I need to reload the page for WordPress to see the new custom field added with jQuery
- Cookie value changes back to previous value after changing
- RSS Feed on WordPress showing code (hypertext) in articles titles
- how to define a html folder to make it work with WordPress commands
- Alternative Hook to the_content for Changing Background Color
- Unpublished Pages Failing To Appear On Custom Path
- Post source link plugin – small modification
- How to add specific script to WordPress webpage that will working with user input and databases
- Hide Plugin Custom Post Type Menu Link
- How to create algorithm for ordering posts in WordPress?
- ACF Fields are not showing up on Homepage
- Add external javascript to post template
- Block plugin update possibilities (but not by hiding notifications)
- Execute function activate/deactivate plugin in specific pages
- Plugin function in child theme
- Soflyy WP All Import Custom File Download Issue
- Update (a function) post’s featured image as soon as $image_url changes
- Why is WP template_include overwritting all templates rather than specified page?
- How to Call Function From Separate WordPress Install on Same Server?
- How to echo a plugin’s function into a template?
- Why isn’t my plugin seeing other classes?
- Wp Ecommerce Reposition Product Page Product Thumbnail Image
- It possible to implement an adhoc php web application with wordpress?
- How to add submenu to WordPress plugin in the same Directory of main Plugin?
- How to Overwrite validate_plugin function
- Contact Form 7: custom validation [closed]
- functions.php conditional output for a single plugin
- Disable plugin function
- Access to wordpress method inside of classes
- Single dash converted to double dash
- How use Dynamic hyperlink on each wordpress post?
- How to prevent page load on form submission
- Send email notification when meet the condition
- How to declare this function correctly?
- WordPress: code structure
- Can’t modify plugin function
- PHP if url extension action=discussion condition use [closed]
- How to disable plugin capability : “create new category”
- Option value not getting updated until page refresh in WordPress
- WordPress Custom Page Blog Template Pagination Problem (Pagination Not Displaying)
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode