Uploaded image for project: 'Snow'
  1. Snow
  2. SNOW-15

WP spitting out an error; expecting a function, getting an array

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Labels:
      None

      Description

       

      Getting this error (not visible) all over the site

      PHP message: PHP Warning:  call_user_func_array() expects parameter 1 to be a valid callback, function 'snow_featured_content' not found or invalid function name in /home/vagrant/sync/wordpress/wp-includes/class-wp-hook.php on line 286" while reading response header from upstream, client: 10.0.2.2, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/php-fpm-wordpress.sock:", host: "localhost:10080", referrer: "http://localhost:10080/alternative-mouse-systems/"
      

      This is coming from functions.php – I believe it is this line that's spitting out the error:

      add_action('widgets_init', $panel['id']);
      

      Instead of functions I've put in the snow panels in an array like so:

      /* Centralised array for the SNOW panel information */
      $snow_panels = array(
      'snow_upcoming_workshops' => array(
      'id' => 'snow_upcoming_workshops',
      'title' => 'Upcoming Workshops',
      'category' => '8'
      ),
      'snow_feature_article' => array(
      'id' => 'snow_feature_article',
      'title' => 'Feature Article',
      'category' => '22'
      ),
      'snow_featured_content' => array(
      'id' => 'snow_featured_content',
      'title' => 'Featured Content',
      'category' => '23'
      )
      );
      

      when it is expecting a function, i.e. snow_upcoming_workshops(), but getting an array instead.

      Might have to revert to putting them back into functions so that this error doesn't show up anymore. 

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              grrrero Eloisa Guerrero
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: