Title: PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback,
Last modified: June 27, 2019

---

# PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback,

 *  [Mohammad Javed](https://wordpress.org/support/users/digitljaved/)
 * (@digitljaved)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/php-warning-call_user_func_array-expects-parameter-1-to-be-a-valid-callback-5/)
 * Hello,
 * I get the following error/warning;
 * `PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback,
   class 'Storefront' does not have a method 'child_scripts' in /public_html/wp-
   includes/class-wp-hook.php on line 286`
 * The product filtering by capacity doesn’t work for this category for some reason.
   The same site and files are on 3 other servers and it works fine, the site is
   on Cloudways and the filtering by capacity on the page in question does not work.
   I’m at loss in how I can resolve this problem.
 * Site info below;
 *     ```
       ### wp-core ###
   
       version: 5.2.2
       site_language: en_GB
       user_language: en_GB
       permalink: /blog/%postname%/
       https_status: true
       user_registration: 0
       default_comment_status: closed
       multisite: false
       user_count: 6
       dotorg_communication: true
   
       ### wp-paths-sizes ###
   
       wordpress_path: /public_html
       wordpress_size: 181.90 MB (190736190 bytes)
       uploads_path: /public_html/wp-content/uploads
       uploads_size: 2.23 GB (2392727395 bytes)
       themes_path: /public_html/wp-content/themes
       themes_size: 14.93 MB (15651266 bytes)
       plugins_path: /public_html/wp-content/plugins
       plugins_size: 151.81 MB (159187740 bytes)
       database_size: 43.21 MB (45311208 bytes)
       total_size: 2.61 GB (2803613799 bytes)
   
       ### wp-active-theme ###
   
       name: storefront-child
       version: 2.2.4
       author: WooThemes
       author_website: https://woocommerce.com/
       parent_theme: Storefront
       theme_features: post-thumbnails, automatic-feed-links, custom-logo, menus, html5, custom-background, site-logo, woocommerce, wc-product-gallery-zoom, wc-product-gallery-lightbox, wc-product-gallery-slider, title-tag, customize-selective-refresh-widgets, custom-header, starter-content, widgets
       theme_path: /public_html/wp-content/themes/storefront
   
       ### wp-themes (1) ###
   
       Storefront: version: 2.2.4, author: WooThemes (latest version: 2.5.0)
   
       ### wp-plugins-active (21) ###
   
       Advanced Custom Fields: version: 5.8.1, author: Elliot Condon
       Advanced Custom Fields PRO: version: 5.8.1, author: Elliot Condon
       Categories Images: version: 2.5.4, author: Muhammad Said El Zahlan
       Disable Gutenberg: version: 1.8.1, author: Jeff Starr
       Filename-based asset cache busting: version: 1.3, author: Ben Lumley
       Google Tag Manager for WordPress: version: 1.9.2, author: Thomas Geiger
       JivoChat: version: 1.3.3, author: JivoChat
       Mailchimp for WordPress: version: 4.5.2, author: ibericode
       Ninja Forms: version: 3.4.16, author: The WP Ninjas
       Premmerce Permalink Manager for WooCommerce: version: 2.1.9, author: premmerce (latest version: 2.1.11)
       Redirection: version: 4.3.1, author: John Godley
       Regenerate Thumbnails: version: 3.1.1, author: Alex Mills (Viper007Bond)
       Simple Custom Post Order: version: 2.4.4, author: Colorlib
       SVG Support: version: 2.3.15, author: Benbodhi
       TAO Schedule Update: version: 1.15, author: TAO Digital
       Tweetlab: version: 2.0.2, author: MaGeek Lab
       WooCommerce: version: 3.6.4, author: Automattic
       WordPress Importer: version: 0.6.4, author: wordpressdotorg
       WP Media Category Management: version: 1.9.4, author: DeBAAT <wp-mcm@de-baat.nl>
       YITH WooCommerce Catalog Mode: version: 1.6.9, author: YITH
       Yoast SEO: version: 11.4, author: Team Yoast (latest version: 11.5)
   
       ### wp-plugins-inactive (8) ###
   
       Akismet Anti-Spam: version: 4.1.2, author: Automattic
       Autoptimize: version: 2.5.1, author: Frank Goossens (futtta)
       Category and Taxonomy Meta Fields: version: 1.0.0, author: Aftab Husain
       Lazy Loader: version: 4.1.0, author: Florian Brinkmann, MarcDK
       Smush: version: 3.2.1, author: WPMU DEV
       W3 Total Cache: version: 0.9.7.5, author: Frederick Townes
       WooCommerce Admin: version: 0.14.0, author: WooCommerce
       Wordfence Security: version: 7.3.4, author: Wordfence
   
       ### wp-media ###
   
       image_editor: WP_Image_Editor_Imagick
       imagick_module_version: 1673
       imagemagick_version: ImageMagick 6.8.9-9 Q16 x86_64 2019-05-13 http://www.imagemagick.org
       imagick_limits: 
       	imagick::RESOURCETYPE_AREA: 4 GB
       	imagick::RESOURCETYPE_DISK: -1
       	imagick::RESOURCETYPE_FILE: 768
       	imagick::RESOURCETYPE_MAP: 4 GB
       	imagick::RESOURCETYPE_MEMORY: 2 GB
       	imagick::RESOURCETYPE_THREAD: 1
       gd_version: 2.2.5
       ghostscript_version: 9.26
   
       ### wp-server ###
   
       server_architecture: Linux 3.16.0-7-amd64 x86_64
       httpd_software: Apache/2.4.10 (Debian)
       php_version: 7.2.14-1+0~20190113100657.14+jessie~1.gbpd83c69 64bit
       php_sapi: fpm-fcgi
       max_input_variables: 2500
       time_limit: 60
       memory_limit: 256M
       max_input_time: 60
       upload_max_size: 10M
       php_post_max_size: 10M
       curl_version: 7.38.0 OpenSSL/1.0.1t
       suhosin: false
       imagick_availability: true
       htaccess_extra_rules: true
   
       ### wp-database ###
   
       extension: mysqli
       server_version: 5.5.62-0+deb8u1
       client_version: mysqlnd 5.0.12-dev - 20150407 - $Id: 38fea24f2847fa7519001be390c98ae0acafe387 $
   
       ### wp-constants ###
   
       WP_HOME: https://www.tuffa.co.uk
       WP_SITEURL: https://www.tuffa.co.uk
       WP_CONTENT_DIR: /public_html/wp-content
       WP_PLUGIN_DIR: /public_html/wp-content/plugins
       WP_MAX_MEMORY_LIMIT: 256M
       WP_DEBUG: false
       WP_DEBUG_DISPLAY: true
       WP_DEBUG_LOG: false
       SCRIPT_DEBUG: false
       WP_CACHE: false
       CONCATENATE_SCRIPTS: undefined
       COMPRESS_SCRIPTS: undefined
       COMPRESS_CSS: undefined
       WP_LOCAL_DEV: undefined
   
       ### wp-filesystem ###
   
       wordpress: writable
       wp-content: writable
       uploads: writable
       plugins: writable
       themes: writable
       ```
   
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fphp-warning-call_user_func_array-expects-parameter-1-to-be-a-valid-callback-5%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Ryan Ray](https://wordpress.org/support/users/ryanr14/)
 * (@ryanr14)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/php-warning-call_user_func_array-expects-parameter-1-to-be-a-valid-callback-5/#post-11683813)
 * Hi [@digitljaved](https://wordpress.org/support/users/digitljaved/),
 * That seems like something in the child theme is causing issues, but I also see
   that Storefront is pretty out of date.
 * Your version is 2.2.4 and the lastest version is 2.5.0. 🙂
 * Nonetheless, the problem you mentioned…
 * > The product filtering by capacity doesn’t work for this category for some reason.
   > The same site and files are on 3 other servers and it works fine, the site 
   > is on Cloudways and the filtering by capacity on the page in question does 
   > not work. I’m at loss in how I can resolve this problem.
 * Just to clarify, looking at the URL you shared you are saying you aren’t able
   to use these two dropdowns? I ask as I was able change the options in those two
   dropdowns?
 * 
    Link to image: [https://cld.wthms.co/RB9wgo](https://cld.wthms.co/RB9wgo)
 *  Thread Starter [Mohammad Javed](https://wordpress.org/support/users/digitljaved/)
 * (@digitljaved)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/php-warning-call_user_func_array-expects-parameter-1-to-be-a-valid-callback-5/#post-11687755)
 * Hi Ryan,
 * I know the theme is quite outdated, it needs updating, I’ve tried this and there
   are loads of breaking changes.
 * The dropdowns are accessible if you filter the products by capacity only it does
   not work, but if you go to another category the capacity filtering works perfectly.
 * I’m baffled that this works on 3 other servers and the server it’s hosted on 
   is where this filtering problem has appeared.
 * I’m not sure what to even do, it might be that we need to update the theme to
   the latest version possible and see if the capacity filtering works on that category
   in question.
 * Thank you,
    J
 *  [Ryan Ray](https://wordpress.org/support/users/ryanr14/)
 * (@ryanr14)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/php-warning-call_user_func_array-expects-parameter-1-to-be-a-valid-callback-5/#post-11693399)
 * Hi [@digitljaved](https://wordpress.org/support/users/digitljaved/),
 * Hmm, that’s interesting. The very same setup works on other servers? For a real
   quick check, can you also post your system status from WooCommerce? One thing
   I’d be looking for in that is that your database version matches the version 
   of WooCommerce on the site.
 * You can find it via WooCommerce > Status. Select “Get system report” and then“
   Copy for support”. Once you’ve done that, paste it here in your response.
 * Also, for clarification, how has that filtering been added to what looks like
   product category pages?
    -  This reply was modified 6 years, 11 months ago by [Ryan Ray](https://wordpress.org/support/users/ryanr14/).
 *  Thread Starter [Mohammad Javed](https://wordpress.org/support/users/digitljaved/)
 * (@digitljaved)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/php-warning-call_user_func_array-expects-parameter-1-to-be-a-valid-callback-5/#post-11695648)
 * Hi [@ryanr14](https://wordpress.org/support/users/ryanr14/)
 * The filtering has been added in through the functions file. We’ve not developed
   the website, we’ve just inherited it so don’t know the ins and outs of the site
   completely.
 * Here is the requested information.
 *     ```
       ### WordPress Environment ###
   
       WordPress address (URL): https://www.tuffa.co.uk
       Site address (URL): https://www.tuffa.co.uk
       WC Version: 3.6.4
       Log Directory Writable: ✔
       WP Version: 5.2.2
       WP Multisite: –
       WP Memory Limit: 256 MB
       WP Debug Mode: –
       WP Cron: ✔
       Language: en_GB
       External object cache: –
   
       ### Server Environment ###
   
       Server Info: Apache/2.4.10 (Debian)
       PHP Version: 7.2.14-1+0~20190113100657.14+jessie~1.gbpd83c69
       PHP Post Max Size: 10 MB
       PHP Time Limit: 60
       PHP Max Input Vars: 2500
       cURL Version: 7.38.0
       OpenSSL/1.0.1t
   
       SUHOSIN Installed: –
       MySQL Version: ❌ 5.5.62-0+deb8u1 - We recommend a minimum MySQL version of 5.6. See: WordPress requirements
       Max Upload Size: 10 MB
       Default Timezone is UTC: ✔
       fsockopen/cURL: ✔
       SoapClient: ✔
       DOMDocument: ✔
       GZip: ✔
       Multibyte String: ✔
       Remote Post: ✔
       Remote Get: ✔
   
       ### Database ###
   
       WC Database Version: 3.6.4
       WC Database Prefix: wp_
       MaxMind GeoIP Database: ✔
       Total Database Size: 44.52MB
       Database Data Size: 35.87MB
       Database Index Size: 8.65MB
       wp_woocommerce_sessions: Data: 0.01MB + Index: 0.00MB
       wp_woocommerce_api_keys: Data: 0.00MB + Index: 0.00MB
       wp_woocommerce_attribute_taxonomies: Data: 0.00MB + Index: 0.00MB
       wp_woocommerce_downloadable_product_permissions: Data: 0.00MB + Index: 0.00MB
       wp_woocommerce_order_items: Data: 0.00MB + Index: 0.00MB
       wp_woocommerce_order_itemmeta: Data: 0.00MB + Index: 0.00MB
       wp_woocommerce_tax_rates: Data: 0.00MB + Index: 0.01MB
       wp_woocommerce_tax_rate_locations: Data: 0.00MB + Index: 0.00MB
       wp_woocommerce_shipping_zones: Data: 0.00MB + Index: 0.00MB
       wp_woocommerce_shipping_zone_locations: Data: 0.00MB + Index: 0.00MB
       wp_woocommerce_shipping_zone_methods: Data: 0.00MB + Index: 0.00MB
       wp_woocommerce_payment_tokens: Data: 0.00MB + Index: 0.00MB
       wp_woocommerce_payment_tokenmeta: Data: 0.00MB + Index: 0.00MB
       wp_woocommerce_log: Data: 0.00MB + Index: 0.00MB
       wp_commentmeta: Data: 0.02MB + Index: 0.03MB
       wp_comments: Data: 0.08MB + Index: 0.09MB
       wp_links: Data: 0.02MB + Index: 0.02MB
       wp_litespeed_optimizer: Data: 0.00MB + Index: 0.00MB
       wp_nf3_actions: Data: 0.02MB + Index: 0.00MB
       wp_nf3_action_meta: Data: 0.05MB + Index: 0.00MB
       wp_nf3_chunks: Data: 0.02MB + Index: 0.00MB
       wp_nf3_fields: Data: 0.02MB + Index: 0.00MB
       wp_nf3_field_meta: Data: 0.09MB + Index: 0.00MB
       wp_nf3_forms: Data: 0.02MB + Index: 0.00MB
       wp_nf3_form_meta: Data: 0.02MB + Index: 0.00MB
       wp_nf3_objects: Data: 0.02MB + Index: 0.00MB
       wp_nf3_object_meta: Data: 0.02MB + Index: 0.00MB
       wp_nf3_relationships: Data: 0.02MB + Index: 0.00MB
       wp_nf3_upgrades: Data: 0.02MB + Index: 0.00MB
       wp_options: Data: 4.22MB + Index: 0.08MB
       wp_postmeta: Data: 16.52MB + Index: 5.97MB
       wp_posts: Data: 12.52MB + Index: 1.06MB
       wp_redirection_404: Data: 0.69MB + Index: 0.36MB
       wp_redirection_groups: Data: 0.00MB + Index: 0.00MB
       wp_redirection_items: Data: 0.01MB + Index: 0.01MB
       wp_redirection_logs: Data: 0.03MB + Index: 0.02MB
       wp_smush_dir_images: Data: 0.00MB + Index: 0.00MB
       wp_termmeta: Data: 0.08MB + Index: 0.03MB
       wp_terms: Data: 0.05MB + Index: 0.03MB
       wp_termsmeta: Data: 0.00MB + Index: 0.01MB
       wp_term_relationships: Data: 0.16MB + Index: 0.14MB
       wp_term_taxonomy: Data: 0.16MB + Index: 0.03MB
       wp_usermeta: Data: 0.11MB + Index: 0.03MB
       wp_users: Data: 0.02MB + Index: 0.05MB
       wp_wc_admin_notes: Data: 0.02MB + Index: 0.00MB
       wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB
       wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB
       wp_wc_download_log: Data: 0.02MB + Index: 0.03MB
       wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB
       wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB
       wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB
       wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB
       wp_wc_product_meta_lookup: Data: 0.05MB + Index: 0.09MB
       wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB
       wp_wfbadleechers: Data: 0.02MB + Index: 0.00MB
       wp_wfblockediplog: Data: 0.02MB + Index: 0.00MB
       wp_wfblocks: Data: 0.02MB + Index: 0.02MB
       wp_wfblocksadv: Data: 0.02MB + Index: 0.00MB
       wp_wfconfig: Data: 0.02MB + Index: 0.00MB
       wp_wfcrawlers: Data: 0.02MB + Index: 0.00MB
       wp_wffilemods: Data: 0.02MB + Index: 0.00MB
       wp_wfhits: Data: 0.02MB + Index: 0.05MB
       wp_wfhoover: Data: 0.02MB + Index: 0.02MB
       wp_wfissues: Data: 0.02MB + Index: 0.00MB
       wp_wfknownfilelist: Data: 0.02MB + Index: 0.00MB
       wp_wfleechers: Data: 0.02MB + Index: 0.00MB
       wp_wflockedout: Data: 0.02MB + Index: 0.00MB
       wp_wflocs: Data: 0.02MB + Index: 0.00MB
       wp_wflogins: Data: 0.02MB + Index: 0.03MB
       wp_wfnet404s: Data: 0.02MB + Index: 0.02MB
       wp_wfnotifications: Data: 0.02MB + Index: 0.00MB
       wp_wfpendingissues: Data: 0.02MB + Index: 0.00MB
       wp_wfreversecache: Data: 0.02MB + Index: 0.00MB
       wp_wfscanners: Data: 0.02MB + Index: 0.00MB
       wp_wfsnipcache: Data: 0.02MB + Index: 0.05MB
       wp_wfstatus: Data: 0.02MB + Index: 0.03MB
       wp_wfthrottlelog: Data: 0.02MB + Index: 0.02MB
       wp_wfvulnscanners: Data: 0.02MB + Index: 0.00MB
       wp_yoast_seo_links: Data: 0.09MB + Index: 0.03MB
       wp_yoast_seo_meta: Data: 0.05MB + Index: 0.05MB
   
       ### Post Type Counts ###
   
       acf-field: 59
       acf-field-group: 4
       attachment: 1845
       custom_css: 1
       faq: 41
       mc4wp-form: 1
       nav_menu_item: 75
       nf_sub: 615
       oembed_cache: 1
       page: 34
       post: 368
       product: 280
       product_variation: 6
       revision: 1865
       scheduled-action: 104
   
       ### Security ###
   
       Secure connection (HTTPS): ✔
       Hide errors from visitors: ✔
   
       ### Active Plugins (21) ###
   
       Advanced Custom Fields PRO: by Elliot Condon – 5.8.1
       Advanced Custom Fields: by Elliot Condon – 5.8.1
       Categories Images: by Muhammad Said El Zahlan – 2.5.4
       Disable Gutenberg: by Jeff Starr – 1.8.1
       Google Tag Manager for WordPress: by Thomas Geiger – 1.9.2 – Not tested with the active version of WooCommerce
       Filename-based asset cache busting: by Ben Lumley – 1.3
       JivoChat: by JivoChat – 1.3.3
       Mailchimp for WordPress: by ibericode – 4.5.2
       Ninja Forms: by The WP Ninjas – 3.4.16
       Redirection: by John Godley – 4.3.1
       Regenerate Thumbnails: by Alex Mills (Viper007Bond) – 3.1.1
       Simple Custom Post Order: by Colorlib – 2.4.4
       SVG Support: by Benbodhi – 2.3.15
       TAO Schedule Update: by TAO Digital – 1.15
       Tweetlab: by MaGeek Lab – 2.0.2
       Premmerce Permalink Manager for WooCommerce: by premmerce – 2.1.9
       WooCommerce: by Automattic – 3.6.4 – 3.6.5 is available
       WordPress Importer: by wordpressdotorg – 0.6.4
       Yoast SEO: by Team Yoast – 11.4 – Not tested with the active version of WooCommerce
       WP Media Category Management: by DeBAAT  – 1.9.4
       YITH WooCommerce Catalog Mode: by YITH – 1.6.9
   
       ### Inactive Plugins (8) ###
   
       Akismet Anti-Spam: by Automattic – 4.1.2
       Autoptimize: by Frank Goossens (futtta) – 2.5.1
       Category and Taxonomy Meta Fields: by Aftab Husain – 1.0.0
       Lazy Loader: by Florian Brinkmann
       MarcDK – 4.1.0
   
       Smush: by WPMU DEV – 3.2.1
       W3 Total Cache: by Frederick Townes – 0.9.7.5
       WooCommerce Admin: by WooCommerce – 0.14.0
       Wordfence Security: by Wordfence – 7.3.4
   
       ### Settings ###
   
       API Enabled: ✔
       Force SSL: –
       Currency: GBP (£)
       Currency Position: left
       Thousand Separator: ,
       Decimal Separator: .
       Number of Decimals: 2
       Taxonomies: Product Types: external (external)
       grouped (grouped)
       simple (simple)
       variable (variable)
   
       Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
       exclude-from-search (exclude-from-search)
       featured (featured)
       outofstock (outofstock)
       rated-1 (rated-1)
       rated-2 (rated-2)
       rated-3 (rated-3)
       rated-4 (rated-4)
       rated-5 (rated-5)
   
       Connected to WooCommerce.com: –
   
       ### WC Pages ###
   
       Shop base: #4 - /shop/
       Basket: #5 - /cart/
       Checkout: #6 - /checkout/
       My account: #7 - /my-account/
       Terms and conditions: ❌ Page not set
   
       ### Theme ###
   
       Name: storefront-child
       Version: 2.2.4
       Author URL: https://woocommerce.com/
       Child Theme: ✔
       Parent Theme Name: Storefront
       Parent Theme Version: 2.2.4 – 2.5.0 is available
       Parent Theme Author URL: https://woocommerce.com/
       WooCommerce Support: ✔
   
       ### Templates ###
   
       Overrides: storefront-child/woocommerce/archive-product.php version 2.0.0 is out of date. The core version is 3.4.0
       storefront-child/woocommerce/global/breadcrumb.php
       storefront-child/woocommerce/loop/orderby.php version 2.2.0 is out of date. The core version is 3.6.0
       storefront-child/woocommerce/single-product/product-attributes.php version 3.1.0 is out of date. The core version is 3.6.0
       storefront-child/woocommerce/single-product/related.php
       storefront-child/woocommerce/single-product/short-description.php version 1.6.4 is out of date. The core version is 3.3.0
       storefront-child/woocommerce/single-product/tabs/tabs.php
       storefront-child/woocommerce/single-product/title.php
       storefront-child/woocommerce/single-product/up-sells.php
   
       Outdated Templates: ❌
   
   
       						Learn how to update
   
       ### Action Scheduler ###
   
       Complete: 103
       Oldest: 2019-06-17 10:04:06 +0000
       Newest: 2019-06-26 11:29:54 +0000
   
       Pending: 0
       Oldest: –
       Newest: –
   
       Canceled: 1
       Oldest: 2019-06-26 12:29:54 +0000
       Newest: 2019-06-26 12:29:54 +0000
   
       In-progress: 0
       Oldest: –
       Newest: –
   
       Failed: 0
       Oldest: –
       Newest: –
       ```
   
 * Let me know if there is anything else you need me to check or provide to you.
 * Thanks,
    Javed
 *  Thread Starter [Mohammad Javed](https://wordpress.org/support/users/digitljaved/)
 * (@digitljaved)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/php-warning-call_user_func_array-expects-parameter-1-to-be-a-valid-callback-5/#post-11717739)
 * Hi [@ryanr14](https://wordpress.org/support/users/ryanr14/)
 * Do we have any updates on this?
 * Thanks,
    Javed
 *  Thread Starter [Mohammad Javed](https://wordpress.org/support/users/digitljaved/)
 * (@digitljaved)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/php-warning-call_user_func_array-expects-parameter-1-to-be-a-valid-callback-5/#post-11759968)
 * Hi [@ryanr14](https://wordpress.org/support/users/ryanr14/)
 * We’ve noticed that the code base has changed and the way the product attribute
   data is being saved into the database.
 * Due to this code change, the filtering has stopped working, you’ll notice that
   it’s working on other categories, the reason for this is because the product 
   has not been saved so the way it stored the data in the database has not updated.
   Once you save the product without making any changes it stores the data different
   to the state that it was currently in. There has been an update somewhere that
   has made the codebase change and the way data is being stored in the database.
   If you need me to set up a staging environment of the website, I can do this 
   for you so you can debug this?
 * It’s changed the filters from a meta value to a term, when looking in the database
   it’s serializing the data. Instead of storing the attribute value against a meta_key
   it now stores a serialised reference to a term
 * Does that make any sense to you?
 * I look forward to hearing from you.
 * Thank you,
    Javed
 *  Thread Starter [Mohammad Javed](https://wordpress.org/support/users/digitljaved/)
 * (@digitljaved)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/php-warning-call_user_func_array-expects-parameter-1-to-be-a-valid-callback-5/#post-11760049)
 * [@ryanr14](https://wordpress.org/support/users/ryanr14/)
 * Here are the functions for the filtering that is located in setup.php in the 
   functions folder situated in the child theme;
 *     ```
       /* Add sorting by attributes */
   
       /**
        *  Defines the criteria for sorting with options defined in the method below
        */
       add_filter( 'woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args' );
       function custom_woocommerce_get_catalog_ordering_args($args)
       {
           global $wp_query;
   
           if ($_GET['orderby']) {
               $orderby_value = $_GET['orderby'];
           } else {
   
               $term = get_queried_object();
               $children = get_terms($term->taxonomy, array(
                   'parent' => $term->term_id,
                   'hide_empty' => false
               ));
               if(!$children){
                   $orderby_value = apply_filters('woocommerce_default_catalog_orderby', get_option('woocommerce_default_catalog_orderby'));
               }else{
                   $orderby_value = ''; // apply_filters('woocommerce_default_catalog_orderby', get_option('woocommerce_default_catalog_orderby'))
               }
           }
   
           $args = null;
           if(array_sum (check_capacity()) > 0){
               if ('pa_capacity_asc' == $orderby_value) {
                   $args['orderby'] = 'meta_value_num';
                   $args['order'] = 'asc';
                   $args['meta_key'] = 'pa_capacity';
               } else if ('pa_capacity_desc' == $orderby_value) {
                   $args['orderby'] = 'meta_value_num';
                   $args['order'] = 'desc';
                   $args['meta_key'] = 'pa_capacity';
               }
           }
   
           return $args;
       }
   
       function check_capacity(){
   
           global $wp_query;
   
           $out = [];
           $curr_cat_id = $wp_query->get_queried_object()->term_id;
           $args = array(
               'post_type' => 'product',
               'posts_per_page' => -1,
               'tax_query' => array(
                   'relation' => 'AND',
                   array(
                       'taxonomy' => 'product_cat',
                       'field' => 'term_id',
                       'terms' => $curr_cat_id
                   )
               ),
           );
           $loop = new WP_Query($args);
           if ($loop->have_posts()): while ($loop->have_posts()): $loop->the_post();
   
               global $product;
               $koostis = array_shift(wc_get_product_terms(get_the_ID(), 'pa_capacity', array('fields' => 'names')));
               $out[get_the_ID()] = $koostis;
   
           endwhile; endif;
           wp_reset_postdata();
   
           return($out);
   
       }
       add_filter( 'woocommerce_default_catalog_orderby_options', 'custom_woocommerce_catalog_orderby' );
   
       /**
        *  Adds the sorting options to dropdown list .. The logic/criteria is in the method above
        */
       add_filter( 'woocommerce_catalog_orderby', 'custom_woocommerce_catalog_orderby' );
       function custom_woocommerce_catalog_orderby( $sortby ) {
           $sortby['pa_capacity_asc'] = 'Sort by Capacity (Asc)';
           $sortby['pa_capacity_desc'] = 'Sort by Capacity (Desc)';
   
           return $sortby;
       }
   
       /**
        *  Save custom attributes as post's meta data as well so that we can use in sorting and searching
        */
       add_action( 'save_post', 'save_woocommerce_attr_to_meta' );
       function save_woocommerce_attr_to_meta( $post_id ) {
           $post_type = get_post_type($post_id);
           // If this isn't a 'product' post, don't update it.
           if ($post_type != 'product')
               return;
   
           // If attribute name and value exist
           if (!empty($_POST['attribute_names']) && !empty($_POST['attribute_values'])) {
               $attribute_names = $_POST['attribute_names'];
               $attribute_values = $_POST['attribute_values'];
   
               // Add post meta data for each attribute
               foreach( $attribute_names as $index => $attribute_name ) {
                   update_post_meta( $post_id, $attribute_name, $attribute_values[$index] );
               }
           }
       }
       ```
   
 *  Thread Starter [Mohammad Javed](https://wordpress.org/support/users/digitljaved/)
 * (@digitljaved)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/php-warning-call_user_func_array-expects-parameter-1-to-be-a-valid-callback-5/#post-11770974)
 * Have a look at these images too [@ryanr14](https://wordpress.org/support/users/ryanr14/)
 * [SCREENSHOTS](https://imgur.com/a/0lUabLs)
 * The first image shows how the attribute data is being stored in the database 
   with the latest version of WooCommerce & WordPress.
 * The second image shows how the attribute USE TO BE stored in the database.
 * Let me know how we can sort this out. Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘PHP Warning: call_user_func_array() expects parameter 1 to be a valid
callback,’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/storefront/4.6.2/screenshot.png)
 * Storefront
 * [Support Threads](https://wordpress.org/support/theme/storefront/)
 * [Active Topics](https://wordpress.org/support/theme/storefront/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/storefront/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/storefront/reviews/)

## Tags

 * [attributes](https://wordpress.org/support/topic-tag/attributes/)
 * [filtering](https://wordpress.org/support/topic-tag/filtering/)
 * [products](https://wordpress.org/support/topic-tag/products/)

 * 8 replies
 * 2 participants
 * Last reply from: [Mohammad Javed](https://wordpress.org/support/users/digitljaved/)
 * Last activity: [6 years, 11 months ago](https://wordpress.org/support/topic/php-warning-call_user_func_array-expects-parameter-1-to-be-a-valid-callback-5/#post-11770974)
 * Status: not resolved