WordPress.org

Forums

TinyMCE Advanced
Warning: call_user_func_array() errors (3 posts)

  1. morningmist
    Member
    Posted 1 year ago #

    So H ave been getting the following errors:

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'do_css' not found or invalid function name in /home/fresheye/public_html/rentlucky.com/wp-includes/plugin.php on line 470

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'do_jslibs' not found or invalid function name in /home/fresheye/public_html/rentlucky.com/wp-includes/plugin.php on line 470

    So far I have concluded that it is possibly related to this plugin.

    Here is the lines in and around line 470 in the plugins.php

    /**
     * Retrieve the name of an action currently being processed.
     *
     * @since 3.9.0
     *
     * @uses doing_filter()
     *
     * @param string|null $action Optional. Action to check. Defaults to null, which checks
     *                            if any action is currently being run.
     * @return bool Whether the action is currently in the stack.
     */
    function doing_action( $action = null ) {
    	return doing_filter( $action );
    }
    
    /**
     * Hooks a function on to a specific action.
     *
     * Actions are the hooks that the WordPress core launches at specific points
     * during execution, or when specific events occur. Plugins can specify that
     * one or more of its PHP functions are executed at these points, using the
     * Action API.
     *
     * @uses add_filter() Adds an action. Parameter list and functionality are the same.
     *
     * @since 1.2.0
     *
     * @param string $tag The name of the action to which the $function_to_add is hooked.
     * @param callback $function_to_add The name of the function you wish to be called.
     * @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
     * @param int $accepted_args optional. The number of arguments the function accept (default 1).
     */
    function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
    	return add_filter($tag, $function_to_add, $priority, $accepted_args);
    }
    
    /**
     * Execute functions hooked on a specific action hook.
     *
     * This function invokes all functions attached to action hook $tag. It is
     * possible to create new action hooks by simply calling this function,
     * specifying the name of the new hook using the <tt>$tag</tt> parameter.
     *
     * You can pass extra arguments to the hooks, much like you can with
     * apply_filters().
     *
     * @see apply_filters() This function works similar with the exception that
     * nothing is returned and only the functions or methods are called.
     *
     * @since 1.2.0
     *
     * @global array $wp_filter Stores all of the filters
     * @global array $wp_actions Increments the amount of times action was triggered.
     *
     * @param string $tag The name of the action to be executed.
     * @param mixed $arg,... Optional additional arguments which are passed on to the functions hooked to the action.
     * @return null Will return null if $tag does not exist in $wp_filter array
     */
    function do_action($tag, $arg = '') {
    	global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
    
    	if ( ! isset($wp_actions[$tag]) )
    		$wp_actions[$tag] = 1;
    	else
    		++$wp_actions[$tag];
    
    	// Do 'all' actions first
    	if ( isset($wp_filter['all']) ) {
    		$wp_current_filter[] = $tag;
    		$all_args = func_get_args();
    		_wp_call_all_hook($all_args);
    	}
    
    	if ( !isset($wp_filter[$tag]) ) {
    		if ( isset($wp_filter['all']) )
    			array_pop($wp_current_filter);
    		return;
    	}
    
    	if ( !isset($wp_filter['all']) )
    		$wp_current_filter[] = $tag;
    
    	$args = array();
    	if ( is_array($arg) && 1 == count($arg) && isset($arg[0]) && is_object($arg[0]) ) // array(&$this)
    		$args[] =& $arg[0];
    	else
    		$args[] = $arg;
    	for ( $a = 2; $a < func_num_args(); $a++ )
    		$args[] = func_get_arg($a);
    
    	// Sort
    	if ( !isset( $merged_filters[ $tag ] ) ) {
    		ksort($wp_filter[$tag]);
    		$merged_filters[ $tag ] = true;
    	}
    
    	reset( $wp_filter[ $tag ] );
    
    	do {
    		foreach ( (array) current($wp_filter[$tag]) as $the_ )
    			if ( !is_null($the_['function']) )
    				call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
    
    	} while ( next($wp_filter[$tag]) !== false );
    
    	array_pop($wp_current_filter);
    }

    Suggestions ideas?

    Where would I add the missing functions?

    https://wordpress.org/plugins/tinymce-advanced/

  2. morningmist
    Member
    Posted 1 year ago #

    I ended up figuring it out after all I needed to add the following code to my functions.php file. I just added it the bottom.

    //css and jslibs
    
     function do_css()
    {
        wp_enqueue_style('thickbox');
    }
    
    function do_jslibs()
    {
        wp_enqueue_script('editor');
        wp_enqueue_script('thickbox');
        add_action( 'admin_head', 'wp_tiny_mce' );
    }
    
    add_action('admin_print_scripts', 'do_jslibs' );
    add_action('admin_print_styles', 'do_css' );
  3. Andrew Ozz
    WordPress Dev
    Plugin Author

    Posted 1 year ago #

    The proper action would be add_action('admin_enqueue_scripts', 'do_jslibs' );.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • TinyMCE Advanced
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.